zoukankan      html  css  js  c++  java
  • 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 引用别名加命名空间

    • 这里写图片描述*

  • 相关阅读:
    Java设计模式
    Java并发编程教程
    Java 教程
    AWT
    Java编程思想
    Java.math.BigDecimal类
    Java8环境设置
    Java.util包教程
    XML
    硬盘空间术语:unallocated, unused and reserved
  • 原文地址:https://www.cnblogs.com/Alex80/p/8142854.html
Copyright © 2011-2022 走看看