报错:无法将类型"System.Data.EntityState"隐式转换为"System.Data.Entity.EntityState"
报错:无法将类型"System.Data.EntityState"隐式转换为"System.Data.Entity.EntityState"。

出错语句停留在:DataContext.Entry(entity).State = EntityState.Modified;
从语法上看没有什么错误。DataContext是在Model层通过添加edmx自动生成的,而出错语句所在的数据层安装了最新版的Entity Framework,我们知道:在edmx中创建实体导入数据库的时候,VS也会为我们自动装上Entity Framework,是否此处的EF版本和数据层不一样呢?
□ 解决方法
先卸载EF:Uninstall-Package EntityFramework -Force
在安装EF5.0:Install-Package EntityFramework –Version 5.0.0
问题解决。
报错:无法将类型"System.Data.EntityState"隐式转换为"System.Data.Entity.EntityState"的更多相关文章
- MVC ---- 无法将类型"System.Data.EntityState"隐式转换为"System.Data.Entity.EntityState"
1.EF 5.0解决方法 先卸载EF:Uninstall-Package EntityFramework -Force 在安装EF5.0:Install-Package EntityFramework ...
- 无法将类型“System.Collections.Generic.List<anonymous type:string ClassID,string ClsssName>”隐式转换为“System.Collections.Generic.List<Ecology.Model.EnergyFlowGraph>”
无法将类型“System.Collections.Generic.List<anonymous type:string ClassID,string ClsssName>”隐式转换为“Sy ...
- using 语句中使用的类型必须可隐式转换为“System.IDisposable
在使用 EF 出现 using 语句中使用的类型必须可隐式转换为“System.IDisposable 今天写在这里分享给大家 出现这样的问题,是因为没有引用 EntityFramework 这个程 ...
- NHibernate无法将类型“System.Collections.Generic.IList<T>”隐式转换为“System.Collections.Generic.IList<IT>
API有一个需要实现的抽象方法: public IList<IPermission> GetPermissions(); 需要注意的是IList<IPermission>这个泛 ...
- using 语句中使用的类型必须可隐式转换为“System.IDisposable”
在entity framework 中错误 using 语句中使用的类型必须可隐式转换为“System.IDisposable” 的错误. 原因是: 没有引用 EntityFramework 这个程序 ...
- 【.NET】using 语句中使用的类型必须可隐式转换为"System.IDisposable"
#问题: 在使用EF开发中,出现如下错误:“using 语句中使用的类型必须可隐式转换为“System.IDisposable” #原因: 项目中没有引用 EntityFramework 这个程序集: ...
- 错误 128 无法将类型“string”隐式转换为“System.Windows.Forms.DataGridViewTextBoxColumn”
原因是DataGridView中列的Name属性值和DataPropertyName属性值一样,比如Name="CardID",DataPropertyName="Car ...
- 使用EF6.0出现:CS0029 无法将类型“System.Data.Entity.Core.Objects.ObjectContext”隐式转换为“System.Data.Objects.ObjectContext”错误
这是因为EF6.0重构了一些命名空间后,和VS原有的实体数据模型模板不一致了(ObjectContext context = ((IObjectContextAdapter)dataContext). ...
- MVC 无法将类型“System.Collections.Generic.List<AnonymousType#1>”隐式转换为“System.Collections.Generic.IList<Mvc3Modeltest.Models.Movie>”。存在一个显式转换(是否缺少强制转换?))
1.问题: 2.解决方案:强制指定类型. 解决之.
随机推荐
- Python 的內建模块
>>> import __builtin__>>> dir(__builtin__)['ArithmeticError', 'AssertionError', 'A ...
- CVE-2011-0104 Microsoft Office Excel缓冲区溢出漏洞 分析
漏洞简述 Microsoft Excel是Microsoft Office组件之一,是流行的电子表格处理软件. Microsoft Excel中存在缓冲区溢出漏洞,远程攻击者可利用此 ...
- Asp.net Vnext 模块化实现
概述 本文已经同步到<Asp.net Vnext 系列教程 >中] 在程序中实现模块化可以加快开发效率,通过替换模块实现升级. 架构 vnext 没有 Virtualpathprovide ...
- Web Api 的 路由机制
ASP.NET Web API 是一种框架,用于轻松构建可以访问多种客户端(包括浏览器和移动设备)的 HTTP 服务. ASP.NET Web API 是一种用于在 .NET Framework 上构 ...
- Java控制多线程执行顺序
package net.jasonjiang.thread; import java.io.IOException; public class ThreadTestNew { public stati ...
- openwrt安装tcpdump
打开openwrt路由器的ssh功能 System->administration Ssh登陆 opkg update 会报很多错误 措施如下: 备份 /etc/opkg.conf Cp /et ...
- 错误: No API token found for service account "default",
[root@kubernetes-master pods]# kubectl create -f mysql.yaml Error from server (ServerTimeout): error ...
- Ubuntu下修改为永久DNS的方法
安装好Ubuntu之后设置了静态IP地址,再重启后就无法解析域名.想重新设置一下DNS,打开/etc/resolv.conf cat /etc/resolv.conf # Dynamic resolv ...
- [ 转载 ] Java基础13--equals方法
一.equals方法介绍 1.1.通过下面的例子掌握equals的用法 1 package cn.galc.test; 2 3 public class TestEquals { 4 public s ...
- Codeforces Round #448 C. Square Subsets
题目链接 Codeforces Round #448 C. Square Subsets 题解 质因数 *质因数 = 平方数,问题转化成求异或方程组解的个数 求出答案就是\(2^{自由元-1}\) , ...