Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/asp.net/33.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Asp.net 实体模型类中存在重复的属性错误_Asp.net_Asp.net Mvc 3_Entity Framework 4 - Fatal编程技术网

Asp.net 实体模型类中存在重复的属性错误

Asp.net 实体模型类中存在重复的属性错误,asp.net,asp.net-mvc-3,entity-framework-4,Asp.net,Asp.net Mvc 3,Entity Framework 4,我的应用程序中有以下模型类: public class Dispute { public long DisputeId { get; set; } //[ForeignKey("Creditor")] FK; [Column("Creditor Registry ID")] public long CreditorRegistryId { get; set; } //[ForeignKey("Registrant")] FK; publ

我的应用程序中有以下模型类:

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; }
}
公共类纠纷
{
公共长DisputeId{get;set;}
//[外国投资者(“债权人”)]FK;
[列(“债权人登记ID”)]
公共长CreditorRegistryId{get;set;}
//[ForeignKey(“注册人”)]FK;
公共长借用器ID{get;set;}
[外汇钥匙(“账户”)]
[列(“债权人注册ID”,顺序=1)]//Fk
public int AccountCreditRegistryId{get;set;}
[外汇钥匙(“账户”)]
[列(“账号”,订单=2)]//Fk
public int AccountNo{get;set;}
公共虚拟帐户{get;set;}
公共虚拟ICollection DisputeTransactions{get;set;}
}
运行应用程序时,出现以下错误:

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:类型中的每个属性名称必须是唯一的。已定义属性名称“债权人注册表ID”

account表具有在争议实体中使用的复合键

请提出解决方案


谢谢。

您确定可以添加两次不同类型的同一列“债权人注册ID”吗

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

[ForeignKey("Account")]
[Column("Creditor Registry ID", Order = 1)]
public int AccountCreditRegistryId { get; set; }
第二财产应为:

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

看起来像是复制粘贴编程风格:)不,我不确定。什么是替代方案?否:[ForeignKey(“Account”)][Column(“债权人注册表ID”,Order=1)]///Fk public int AccountCreditRegistryId{get;set;}从错误外观上看,可能不支持对两个不同的属性使用相同的列名。