The EF team seems to have eliminated the infamous database initializers and offers a more universal method for version 7.
Just use these methods in the pipeline before any call to the database,
yourDbContext.Database.EnsureCreated();
to create a database if it does not exist, and
yourDbContext.Database.Migrate();
to apply migration (if you use this function later). Both of the above methods also have an asynchronous version.
In my solution, I created a static class that I use to initialize the database and populate it with some data. I call the Seed method from the Configure method in the Startup class when a condition is met.
Vi100
source share