How to Seed Your Database With EF Core

Yesterday, I showed how to do EF Core DB migrations using either the Package Manager Console or the .NET CLI. But you can also do these code migrations automatically, triggering them via code.
After following the steps shown yesterday, you have all your migrations setup, and you can apply the DB changes using the dotnet CLI. But there is a lesser-known feature, that is still experimental and not ironed out completely, that makes it possible to run migrations from code, and even seed the DB with initial data.

Link: https://dzone.com/articles/how-to-seed-your-database-with-ef-core?utm_medium=feed&utm_source=feedpress.me&utm_campaign=Feed%3A+dzone%2Fwebdev