2014-10-07 56 views
0

我第一次使用EF模型MVC不明確的引用,我有問題與此錯誤:「RequiredAttribute標籤」是MVC

'RequiredAttribute' is an ambiguous reference between 'System.ComponentModel.DataAnnotations.RequiredAttribute' and 'ServiceStack.DataAnnotations.RequiredAttribute

我不能使用System.ComponentModel.DataAnnotationsServiceStack.DataAnnotations。我需要他們兩人索引列和也要求列

我無法找到解決方案。

+0

你試過'[System.ComponentModel.DataAnnotations.Required]'還是'[ServiceStack.DataAnnotations.Required]'? – jao 2014-10-07 12:23:56

+0

感謝你回答 我使用 using System.ComponentModel; using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations.Schema;使用ServiceStack.DataAnnotations的 ; – RaziHosseiny 2014-10-12 12:19:38

回答

0

刪除[Required]屬性並分別添加[System.ComponentModel.DataAnnotations.Required][ServiceStack.DataAnnotations.Required]以便解決歧義。

+0

感謝您的答案,但它不起作用 – RaziHosseiny 2014-10-12 12:21:45