System.ComponentModel.DataAnnotations.Schema.TableAttribute 同时存在于EntityFramework.dll和System.ComponentModel.DataAnnotations.dll中
2017-04-18 10:56
1116 查看
Entity Framework 与 .net4.5 的 System.ComponentModel.DataAnnotations 都有 System.ComponentModel.DataAnnotations.Schema 命名空间。并且都有一些相同的 特性(Attribute), 如:ForeignKeyAttribute, NotMappedAttribute 等。当项目同时引用了 EntityFramework.dll 与 System.ComponentModel.Composition.dll ,你将不能正常使用上面提到的特性。
使用别名,给这两个dll 加一个不同的根。
引用dll, 默认的别名都是 global
1、将 EntityFramework.dll 的别名改为 EF
2、在类的using 区域写入 extern alias EF;
3、using EF::System.ComponentModel.DataAnnotations.Schema; //引用别名加命名空间
4、DbContext更新
使用别名,给这两个dll 加一个不同的根。
引用dll, 默认的别名都是 global
1、将 EntityFramework.dll 的别名改为 EF
2、在类的using 区域写入 extern alias EF;
3、using EF::System.ComponentModel.DataAnnotations.Schema; //引用别名加命名空间
4、DbContext更新
相关文章推荐
- System.ComponentModel.DataAnnotations.Schema.TableAttribute 同时存在于EntityFramework.dll和System.Componen
- System.ComponentModel.DataAnnotations.Schema 冲突
- System.ComponentModel.DataAnnotations dll中标签的用法
- System.ComponentModel.DataAnnotations.Schema 冲突
- 新建MVC3项目时出错:错误 2 类型“System.Web.Mvc.ModelClientValidationRule”同时存在于“C:\Program Files\Microsoft ASP.NET\ASP.NET Web Pages\v2.0\Assemblies\System.Web.WebPages.dll”和“C:\Program Files\Microsoft ASP.NET\ASP.NET MVC 3\Assembli
- System.Web.Mvc.ModelClientValidationRule 同时存在于System.Web.Mvc.dll System.Web.WebPages.dll
- using System.ComponentModel.DataAnnotations
- using System.ComponentModel.DataAnnotations
- System.ComponentModel.DataAnnotations表示与数据字段和参数关联的数据类型的枚举
- “System.Data.Entity.Infrastructure.DbUpdateConcurrencyException”类型的异常在 EntityFramework.dll 中发生,但未在用户
- System.Data.Entity.Core.MetadataException类型的异常在EntityFramework.dll中发生
- 第6章 数据注解 System.ComponentModel.DataAnnotations 、注解后台原理、自定义验证ValidationAttribute、IValidatableObject
- System.ComponentModel.DataAnnotations 命名空间和RequiredAttribute 类
- MVC3 类型 System.Web.Mvc.ModelClientValidationRule 同时存在
- Entity Framework Code First (三)Data Annotations
- MVC3 类型“System.Web.Mvc.ModelClientValidationRule”同时存在
- “CreateRiaClientFilesTask”任务意外失败。 未能加载文件程序集“System.ComponentModel.DataAnnotations 处理办法
- EntityFramework Data Annotations
- MVC3 类型 System.Web.Mvc.ModelClientValidationRule 同时存在
- Entity Framework DataAnnotations