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 ...
随机推荐
- Java-JUC(十):线程按序交替执行
问题: 有a.b.c三个线程,使得它们按照abc依次执行10次. 实现: package com.dx.juc.test; import java.util.concurrent.locks.Cond ...
- 转: linux进程地址图解
http://www.cnblogs.com/clover-toeic/p/3754433.html
- 转:C++操作mysql方法总结(1)
原文:http://www.cnblogs.com/joeblackzqq/p/4332945.html C++通过mysql的c api和通过mysql的Connector C++ 1.1.3操作m ...
- dubbo 提示No such extension Filter for filter/com.alibaba.dubbo.rpc.Filter
配置时 <dubbo:provider filter="DubboExceptionFilter"></dubbo:provider> DubboExcep ...
- ESXI安装时卡在loading ipmi_si_drv的解决方案
参考:http://x220ak.hatenablog.com/ 在这个界面按下shift+O,输入runweasel noipmiEnabled即可跳过loading ipmi_si_drv的加载
- [Spring boot] Read values from external properties file
Let's say we have a extral app.proporites file which contains some extra configuration: // resources ...
- IC卡制作常识概述
ic卡主要有9种: 1.接触型IC卡: 2.非接触型IC卡: 3.串行传输型IC卡: 4.并行传输型IC卡: 5.存储型IC卡: 6.智能型IC卡: 7.超级 ...
- linux:C++实现ping
转载自: //http://blog.chinaunix.net/uid-25909722-id-2762079.html #include <stdio.h> #include < ...
- I/O Mutiplexing poll 和 epoll
上一篇介绍了select的基本用法,接着来学习一下poll和epoll的基本用法.首先来看poll: #include <sys/poll.h> int poll (struct poll ...
- input[type="checkbox"]与label对齐
项目中遇到文字与 checkbook 无法水平对齐, 源码如下: <div align='center'> <input type="checkbox" id=& ...