EF code first - Model compatibility cannot be checked because the database does not contain model metadata

前端 未结 5 876
一向
一向 2020-12-29 16:16

I have enabled automatic migrations. Then, I deleted my whole db. Next, i executed Update-database from command console, and it recreated my db. Then, I started

5条回答
  •  一整个雨季
    2020-12-29 16:50

    Detach your local Database say example 'database1.mdf' from visual studio 'server explorer' and then open SQL server management studio right click on Databases > Attach and then browse the same 'database1.mdf' file .If you doesn't have access then copy&past both the mdf and ldf files into c drive and do attach.

    Then open new query window on sql server then do copy your identity tables as like below query.

    *'select * into [__MigrationHistory] from Database1.dbo.__MigrationHistory '*

提交回复
热议问题