When is the Seed method called in a EF code first migrations scenario?

前端 未结 2 1231
旧巷少年郎
旧巷少年郎 2021-01-01 13:50

I\'m new in a project and there is this class for the seed data:

 internal sealed class Configuration : DbMigrationsConfiguration
    {
           


        
2条回答
  •  走了就别回头了
    2021-01-01 14:46

    Seed method is used to initialized the database tables with some starting data. Whenever you run the migration and update the database it will run the seed method. Mostly it is used during the testing phase where you often need to recreate the database and populate database tables with sample data. Please go through this link http://blog.oneunicorn.com/2013/05/28/database-initializer-and-migrations-seed-methods/ for more explaination on code first.

提交回复
热议问题