Entity Framework Migrations - Enable AutoMigrations along with added migration

后端 未结 6 1578
青春惊慌失措
青春惊慌失措 2021-02-04 09:34

I\'m utilizing Entity Framework 4.3 Migrations in my project. I would like to use Automatic migrations so that when I make modifications to my domain objects and my context cla

6条回答
  •  再見小時候
    2021-02-04 09:53

    You just need to do

        private static void InitializeDataStore()
        {
            System.Data.Entity.Database.SetInitializer(new System.Data.Entity.MigrateDatabaseToLatestVersion());
            System.Data.Entity.Database.Initialize(false);
        }
    

提交回复
热议问题