llk8

MVC开发/常见错误集锦

  博客园  :: 首页  :: 新随笔  :: 联系 :: 订阅 订阅  :: 管理

随笔分类 -  MVC错误代码

摘要:What it sounds like to me is that you're getting a user from one context, and attempting to delete from another.E.g.User myUser =null;using(MyData data =newMyData()){ myUser = data.GetUserById(1);} using(MyData data =newMyData()){ data.DeleteUser(myUser);}The 2nd "data" doesn't kno 阅读全文
posted @ 2014-01-11 17:59 llk8 阅读(1175) 评论(0) 推荐(0)

摘要:EntityType 'BookInfo' has no key defined. Define the key for this EntityType建的模型需要有PK主关键字,默认为’Id’或者‘实体名Id',如果PK不是这两个,要先添加[Key]到PK上方。具体查看本博客文章:http://www.cnblogs.com/llk8/category/545808.html 阅读全文
posted @ 2014-01-04 16:30 llk8 阅读(296) 评论(0) 推荐(0)

摘要:1、工具——》库程序包管理器——》管理解决方案的nuget程序包2、选中已安装的包,找到EntityFramework,点击管理,后面的你应该就清楚啦!当然我用的是VS2012,如果你的版本较低的话,可能需要先安装Nuget。可以先卸载再添加。最后看下引用里面有没有即可。 阅读全文
posted @ 2014-01-04 16:29 llk8 阅读(2324) 评论(0) 推荐(0)