我創建了一些類並配置了連接字符串。如何使用實體框架代碼優先
但還是得到了一個錯誤:
Unhandled Exception: System.NotSupportedException: Model compatibility cannot be checked because the database does not contain model metadata. Model compatibility can only be checked for databases created using Code First or Code First Migrations.
你是如何創建數據庫的? – 2012-04-15 08:53:25
@LadislavMrnka代碼優先功能可以通過代碼創建數據庫。 – 2012-04-15 12:15:18
我通過在程序包管理器控制檯中運行'Enable-Migrations'命令來修復它 。 – 2012-04-15 12:21:36