Invalid object name 'dbo.__MigrationHistory' using Database.Create; EF6.02 when connection string is passed in

后端 未结 4 451
故里飘歌
故里飘歌 2020-12-10 23:46

I experience an error when trying to create a database using the following code. Note the problem does not happen if the connection string is not passed in. Also the problem

4条回答
  •  情话喂你
    2020-12-11 00:12

    You can turn off code first database initialization for your database, by adding this to your context's constructor:

    System.Data.Entity.Database.SetInitializer(null);
    

    This should prevent the attempt to access dbo.__MigrationHistory.

提交回复
热议问题