0
我有以下的模型类在我的应用程序:重复属性的实体模型类属性错误
public class Dispute
{
public long DisputeId { get; set; }
//[ForeignKey("Creditor")] FK;
[Column("Creditor Registry ID")]
public long CreditorRegistryId { get; set; }
//[ForeignKey("Registrant")] FK;
public long BorrowerId { get; set; }
[ForeignKey("Account")]
[Column("Creditor Registry ID", Order = 1)] // Fk
public int AccountCreditRegistryId { get; set; }
[ForeignKey("Account")]
[Column("Account No", Order = 2)] // Fk
public int AccountNo { get; set; }
public virtual Account Account { get; set; }
public virtual ICollection<DisputeTransaction> DisputeTransactions { get; set; }
}
和我收到以下错误,当我运行应用程序:
指定的架构是无效的。错误: (90,6):错误0019:类型中的每个属性名称必须是唯一的。属性名称'Creditor Registry ID'已被定义。
账户表具有用于争议实体的组合密钥。
请建议解决方案。
谢谢。
貌似复制和粘贴的编程风格:) – 2011-04-25 13:15:39
不,我不知道。 Whar是另一种选择? – DotnetSparrow 2011-04-25 13:24:03
不是:[ForeignKey(“Account”)] [Column(“Creditor Registry ID”,Order = 1)] // Fk public int AccountCreditRegistryId {get;组; } – DotnetSparrow 2011-04-25 13:33:09