使用EF的時候映射數據的時候,出現了下面的問題。如圖:數據庫
錯誤的提示爲: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.spa
解決方法:3d
USE [master] GO /****** Object: Database [DBname] ******/ ALTER DATABASE [DBname] SET SINGLE_USER WITH ROLLBACK IMMEDIATE ALTER DATABASE [DBname] SET SINGLE_USER WITH NO_WAIT DROP DATABASE [DBname] GO
DBname 即爲你的數據庫名稱,執行完上面的這段Sql語句,上面出現的問題就解決了。code