System.ComponentModel.DataAnnotations.Schema 冲突
System.ComponentModel.DataAnnotations.Schema 冲突
Entity Framework 与 .net4.5 的 System.ComponentModel.DataAnnotations 都有 System.ComponentModel.DataAnnotations.Schema 命名空间。并且都有一些相同的 特性(Attribute), 如:ForeignKeyAttribute, NotMappedAttribute 等。当项目同时引用了 EntityFramework.dll 与 System.ComponentModel.Composition.dll ,你将不能正常使用上面提到的特性。
使用别名,给这两个dll 加一个不同的根。
引用dll, 默认的别名都是 global
将 EntityFramework.dll 的别名改为 EF
在类的using 区域写入 extern alias EF;
*using EF::System.ComponentModel.DataAnnotations.Schema 引用别名加命名空间
*
*
System.ComponentModel.DataAnnotations.Schema 冲突的更多相关文章
- 解决EntityFramework与System.ComponentModel.DataAnnotations命名冲突
比如,定义entity时指定一个外键, [ForeignKey("CustomerID")] public Customer Customer { get; set; } 编译时报 ...
- System.ComponentModel.DataAnnotations.Schema.TableAttribute 同时存在于EntityFramework.dll和System.ComponentModel.DataAnnotations.dll中
Entity Framework 与 .net4.5 的 System.ComponentModel.DataAnnotations 都有 System.ComponentModel.DataAnno ...
- System.ComponentModel.DataAnnotations 冲突
项目从原来的.NET Framework4.0 升级到 .NET Framework4.5 编译报错. 查找原因是: Entity Framework 与 .net4.5 的 System.Compo ...
- 对System.ComponentModel.DataAnnotations 的学习应用
摘要 你还在为了验证一个Class对象中很多数据的有效性而写很多If条件判断吗?我也同样遇到这种问题,不过,最近学了一项新的方法,让我不在写很多if条件做判断,通过给属性标注特性来验证数据规则,从此再 ...
- System.ComponentModel.DataAnnotations 命名空间和RequiredAttribute 类
System.ComponentModel.DataAnnotations 命名空间提供定义 ASP.NET MVC 和 ASP.NET 数据控件的类的特性. RequiredAttribute 指定 ...
- 使用System.ComponentModel.DataAnnotations验证字段数据正确性
在.NET MVC 中,当页面提交model到Action的时候,自动填充ModelState.使用ModelState.IsValid进行方便快捷的数据验证,其验证也是调用命名空间System.Co ...
- C# 特性 System.ComponentModel 命名空间属性方法大全,System.ComponentModel 命名空间的特性
目录: System.ComponentModel 特性命名空间与常用类 System.ComponentModel.DataAnnotations ComponentModel - Classes ...
- “CreateRiaClientFilesTask”任务意外失败。 未能加载文件程序集“System.ComponentModel.DataAnnot...
错误 77 “CreateRiaClientFilesTask”任务意外失败. System.Web.HttpException (0x80004005): 未能加载文件或程序集“System. ...
- 异常详细信息: System.ComponentModel.Win32Exception: 拒绝访问。
本地win7 本地正常,服务器win2008r2,服务器报错! 异常详细信息: System.ComponentModel.Win32Exception: 拒绝访问. 拒绝访问. 说明: 执行当前 W ...
随机推荐
- javascript 关键字不能作为变量来使用
var cfg={export: "export.aspx"} 这句代码中使用了一个关键字“export” 所以在IE8中报错. 那么有哪些关键字不能作为变量呢? 关键字”就是 J ...
- (转)C/C++ 程序设计员应聘常见 面试笔试 试题深入剖析
C/C++ 程序设计员应聘常见 面试笔试 试题深入剖析 http://www.nowcoder.com/discuss/1826?type=2&order=0&pos=23&p ...
- Web - TCP的三次握手
在TCP/IP协议中,TCP协议提供可靠的连接服务,採用三次握手建立一个连接. 第一次握手:建立连接时,client发送syn包(syn=j)到server,并进入SYN_SENT状态,等待serv ...
- LintCode: Median of two Sorted Arrays
求第k个值 1.归并排序 归并到第k个值为止 时间复杂度:O(k) class Solution { public: // merge-sort to find K-th value double h ...
- 【树莓派】树莓派与XBMC及Kodi、LibreELEC插件(一)
网上高人多. 高手在民间,饭桶在机关. 越用树莓派,越发现这玩意儿的潜力,我想,未来我们用它,可以做很多事情. 最近在看树莓派的应用场景,看到网上有人用它做电视盒子. 参考相关文章,简单实践了一下,整 ...
- Linux中使用pwconv实现passwd中密码到shadow
1.功能说明:开启用户的投影密码. 2.语 法:pwconv 3.个人理解:就是将/etc/passwd里的密码用x代替,并将真实密码(当然是加密后的)转移到/etc/shadow里面. 4.补充说明 ...
- angularjs显示html片段
ngBindHtml <div ng-controller="ExampleController"> <p ng-bind-html="myHTML&q ...
- vuejs组件交互 - 01 - 父子组件之间的数据交互
父子组件之间的数据交互遵循: props down - 子组件通过props接受父组件的数据 events up - 父组件监听子组件$emit的事件来操作数据 示例 子组件的点击事件函数中$emit ...
- sublime text执行PHP代码
新建编译系统 { "cmd": ["php", "$file"], "file_regex": "php$&q ...
- python 爬虫资料
API Requests PyQuery http://www.tuicool.com/articles/UZrmUb2 http://blog.csdn.net/cnmilan/article/de ...