2012-11-13 41 views
0

我收到我的实体框架代码首先应用这个错误,我不知道为什么,因为关键是明确规定:模型生成过程中检测到实体框架'密钥未定义',当它明确是什么?

一个或多个验证错误: System.Data.Entity的.Edm.EdmEntityType :: EntityType'Image'没有定义关键字 。定义此EntityType的关键字。

这是我的图像模型。

using System; 
using System.ComponentModel.DataAnnotations; 
using System.Runtime.Serialization; 

namespace Locabal.Model 
{ 
    [DataContract] 
    public class Image : IIndexable<Uri> 
    { 
     [DataMember] public Uri UrlBase { get { return Id; } set { Id = value; } } 
     [Key][DataMember] public Uri Id { get; set; } 

     [DataMember] public string Description { get; set; } 
    } 
} 

回答

0

数据类型Uri不受EF支持。使用其他适当的数据类型。

相关问题