![](/img/trans.png)
[英]C# Error: Error CS0246 The type or namespace name '' could not be found (are you missing a using directive or an assembly reference?)
[英]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; 但似乎不起作用。
我该如何解决?
================================================== ===
最后,我解决了这个问题! 为什么我不能引用System.ComponentModel.DataAnnotations?
System.ComponentModel.DataAnnotations是ForeignKey和Required的命名空间。
System.ComponentModel.DataAnnotations.Schema更具体。 例如,如果您想将字段映射到特定的列名或将实体映射到表名。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.