开发者

Duplicate property attribute error in entity model class

I have following model class in my application:

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 Bor开发者_如何学CrowerId { 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; }
}

and I am getting following error when I run the application:

Schema specified is not valid. Errors: (90,6) : error 0019: Each property name in a type must be unique. Property name 'Creditor Registry ID' was already defined.

account table has composite key which is being used in dispute entity.

Please suggest solution.

Thanks.


Are you sure you can add the same column "Creditor Registry ID" twice and of a different type?

[Column("Creditor Registry ID")]
public long CreditorRegistryId { get; set; }

[ForeignKey("Account")]
[Column("Creditor Registry ID", Order = 1)]
public int AccountCreditRegistryId { get; set; }

should the 2nd property be:

[ForeignKey("Account")]
[Column("Account Credit Registry Id")]
public int AccountCreditRegistryId { get; set; }
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜