Introduction
A fresh database is useless until something fills it. EF Core gives you three different ways to do that, and most projects pick one and force everything through it. That is how you end up with fake data baked into a migration, or a production table that never got its rows.
The fix is to stop treating seed data as one thing. In this post I build a small .NET 10 expense tracker on EF Core 10 and SQL Server that uses all three approaches side by side: HasData for fixed reference data, UseSeeding / UseAsyncSeeding for default data the app needs, and a custom seeder class with Bogus for local fake data. One fresh database fills itself with all three, and running the app twice doesn't duplicate a single row.
🎬 Watch the full video here:
Three kinds of seed data, three tools
Before any code, sort your data into one of these buckets:
Fixed reference data - currency codes, country lists. The same in every environment, and it only changes when you decide to change it.…