解决Entity Framework Code First 的问题——Model compatibility cannot be checked because the database does not contain model metadata
2013-01-08 22:13
791 查看
这两天在虚拟机里重新学习了一下ASP.NET MVC,然后就在Codeplex网站里面找到MVCMusicStore的代码进行研究,跟着它的代码一步一步学习下去。结果在使用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.
解决方法:
DBname 即为你的数据库名称,执行完上面的这段Sql语句,上面出现的问题就解决了。
错误的提示为: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.
解决方法:
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 First 经常出现 Model compatibility cannot be checked because the database does not contain model metadata. Ensure that IncludeMetadataConvention has
- Model compatibility cannot be checked because the database does not contain model metadata. Ensure that IncludeMetadataConvention has been added to the DbModelBuilder conventions
- 解决MVC EF Code First错误:Model compatibility cannot be checked because the EdmMetadata type was not included in the model.
- Online Music Store: EF 4 Code Only方式出错"Model compatibility cannot be checked because the database does not contain"
- SQL Server 对等复制配置失败后无法删除重建,报错:Cannot execute as the database principal because the principal "dbo" does not exist, this type of principal cannot be im
- SQL 2005 建立数据库图表时出现以下错误Database diagram support objects cannot be installed because this database does not have a valid owner 解决
- The service cannot be activated because it does not support ASP.NET compatibility
- The service cannot be activated because it does not support ASP.NET compatibility
- The service cannot be activated because it does not support ASP.NET compatibility
- The service cannot be activated because it does not support ASP.NET compatibility
- Cannot execute as the database principal because the principal "guest" does not exist, this type of principal cannot be impersonated, or you do not have permission.
- 解决 The Controls collection cannot be modified because the control contains code blocks (i.e. )问题
- The service cannot be activated because it does not support ASP.NET compatibility. ASP.NET compatibility is enabled for this application. Turn off ASP.NET compatibility mode in the web.config or add the AspNetCompatibilityRequirements attribute to the ser
- The service cannot be activated because it does not support ASP.NET compatibility
- Resolve Error: The service cannot be activated because it does not support ASP.NET compatibility.
- 解决问题:The context cannot be used while the model is being created
- 关于applicationContext.xml cannot be opened because it does not exist的解决
- LINQ to Entities does not recognize the method , and this method cannot be translated into a store expression 解决办法
- 在线安装maven插件问题:Cannot complete the install because one or more required items could not be found.
- because the principal "dbo" does not exist 问题解决方法