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 ...
随机推荐
- OpenNebula学习第二节OpenNebula Node Installation
一.准备工作 准备一台物理机或者虚拟机:Ubuntu16.0.4 已经更新了aliyun的source cpu支持虚拟化 关闭防火墙 二.安装步骤 2.1:下载opennebula repo源 wge ...
- (转)C#垃圾回收机制详解
GC的前世与今生 虽然本文是以.net作为目标来讲述GC,但是GC的概念并非才诞生不久.早在1958年,由鼎鼎大名的图林奖得主John McCarthy所实现的Lisp语言就已经提供了GC的功能,这是 ...
- 安装ecshop2.7时候的错误处理 php版本不兼容引起
装ECShop2.7.3出现了一堆问题,主要是因为PHP版本过高引起的,不愿意降低版本,则只能一个个解决啦!这些问题包括:preg_replace.cls_image::gd_version.end( ...
- 详解使用DockerHub官方的mysql镜像生成容器
详解使用DockerHub官方的mysql镜像生成容器 收藏 yope 发表于 10个月前 阅读 1506 收藏 32 点赞 1 评论 0 腾讯云·云上实验室:开发者零门槛,免费使用真机在线实验!&g ...
- C#.NET常见问题(FAQ)-override覆盖和virtual虚类如何理解
父类使用virtual关键字,可以让子类的实例完全代替基类的类成员.(前面父类virtual后面子类override),比如下面我定义一个Employee的员工的基类,给这个基类定义了Start_Wo ...
- html块元素和内联元素
html块元素和内联元素: 对于html各种标签/元素,可以从块的层面做一个分类:要么是block(块元素),要么是inline(内联元素). block元素的特点: 总是另起一行开始: 高度,行高以 ...
- c/c++ 函数指针的用法
[目录] 基本定义 c 函数指针使用举例 c++ 函数指针使用举例 函数指针作为函数参数 函数指针作为函数返回值 函数指针数组 typedef 简化函数指针操作 c语言函数指针的定义形式:返回类型 ( ...
- Linux中禁用THP(Transparent Huge Pages)
一.简介 Centos6开始引入THP,Centos7时默认启用,用来提升内存性能. 二.说明 争对一些数据库,如Oracle.MariaDB.MongoDB.VoltDB在使用时,要求关闭此功能. ...
- 对IIC总线时序的一点理解以及ACK和NACK(NAK)
参考自:http://blog.chinaunix.net/uid-16100003-id-3059814.html 关于IIC的响应问题:对于每一个接收设备(从设备,slaver),当它被寻址后,都 ...
- JSP入门实战下
第一部分简单解说:jsp语法的规范,以及三大编译指令,七个动作指令和九大内置对象,生命周期解说等. 这章主要解说el表达式,核心标签库. 所有代码下载:链接 1.核心标签库(JSTL:c)解说: 1. ...