Shawn Wildermuth

Author, Teacher, and Filmmaker
.NET Foundation Board Member


Tagged with Entity Framework Core

Re-thinking Running Migrations and Seeding in ASP.NET Core 2.0

SeedBack in ASP.NET 4, I really liked the way that it supported running migrations and seeding of the database for you. But in ASP.NET Core and EF Core, that hasn't come to the table yet.

I doubt it actually needs to happen because since ASP.NET Core gives you much more control over the life cycle of the web project. In Entity Framework Core, I've been using an approach to run migrations and seed the database that I kind of crufted together in the Betas. I don't think it's working.

Back when I realized that you couldn't just use the seeding and initialization from EF6 in Entity Framework Core, I looked at a few solutions and pick and choose what made the most sense to me. This is what I had come up with: