Error1Failed to get the MetadataWorkspace for the DbContext type

Error1Failed to get the MetadataWorkspace for the DbContext type 

此错误正是由于code first 无法与数据库实体成功连接而造成的。解决办法是必须找到你出错的datacontext定义类的构造函数中。看看是不是没有定义数据库连接字符串,如果你使用的是config定义的数据库连接字符串同理查询并更正确定连接字符串可以正常使用。

posted @ 2013-03-17 10:31  一梦三只鸭  阅读(338)  评论(0编辑  收藏  举报