2014-10-07 58 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