CS0246 C# 找不到类型或命名空间名称 'ForeignKeyAttribute'(是否缺少 using 指令或程序集引用?)
CS0246 C# The type or namespace name 'ForeignKeyAttribute' could not be found (are you missing a using directive or an assembly reference?)
我正在学习使用 Entity Framework Code First 创建我的数据库
通过 Azure 移动应用服务
但是我得到一个错误,它看起来像
CS0246 C# The type or namespace name 'ForeignKeyAttribute'
could not be found (are you missing a using directive or an assembly reference?)
我已经用过System.ComponentModel.DataAnnotations.Schema;
但它似乎不起作用。
我该如何解决这个问题?
=========================================== ========
最后参考这个解决了!!
Why can't I reference System.ComponentModel.DataAnnotations?
System.ComponentModel.DataAnnotations 是 ForeignKey 的命名空间,也是必需的。
System.ComponentModel.DataAnnotations.Schema 更具体。例如,如果要将字段映射到特定列名或将实体映射到 table 名称。
我正在学习使用 Entity Framework Code First 创建我的数据库 通过 Azure 移动应用服务
但是我得到一个错误,它看起来像
CS0246 C# The type or namespace name 'ForeignKeyAttribute'
could not be found (are you missing a using directive or an assembly reference?)
我已经用过System.ComponentModel.DataAnnotations.Schema; 但它似乎不起作用。
我该如何解决这个问题?
=========================================== ========
最后参考这个解决了!! Why can't I reference System.ComponentModel.DataAnnotations?
System.ComponentModel.DataAnnotations 是 ForeignKey 的命名空间,也是必需的。
System.ComponentModel.DataAnnotations.Schema 更具体。例如,如果要将字段映射到特定列名或将实体映射到 table 名称。