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.