![](/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.