Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/asp.net-mvc/15.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 mvc 复合键和外键_Asp.net Mvc_Entity Framework 4_Entity - Fatal编程技术网

Asp.net mvc 复合键和外键

Asp.net mvc 复合键和外键,asp.net-mvc,entity-framework-4,entity,Asp.net Mvc,Entity Framework 4,Entity,我正在开发asp.net MVC3应用程序,我有以下实体 此实体的复合键CreditRegistryId和AccuBunt No为主键。CreditRegistryId也是一个外键。如何制作组合键和外键。我正在使用EF4.1中的DbContext API。我没有使用edmx ORM设计器 [Table("tbaAccount")] public class Account { [Column(Name="Creditor Registry ID")] // PK

我正在开发asp.net MVC3应用程序,我有以下实体

此实体的复合键CreditRegistryId和AccuBunt No为主键。CreditRegistryId也是一个外键。如何制作组合键和外键。我正在使用EF4.1中的DbContext API。我没有使用edmx ORM设计器

[Table("tbaAccount")]
    public class Account
    {

       [Column(Name="Creditor Registry ID")]  // PK FK
       public int CreditRegistryId {get;set;}


       [Column(Name = "[Account No]")]        //PK
       public int AccountNo { get; set; }

       [Column(Name = "[Date Opened]")]
       public DateTime DateOpened { get; set; }

       [ForeignKey("tblAccountStatus")]
       [Required]
       [Column(Name = "Account Status ID")]  // FK
       public int AccountStatusId { get; set; }

       [Required]
       [Column(Name = "Date First Reported")]
       public DateTime DateFirstReported { get; set; }

       [Required]
       [Column(Name = "Credit Limit")]
       public double CreditLimit { get; set; }

       [Required]
       public double Balance { get; set; }
}
和其他实体让我们说是

public class CreditRegistry
        {
public int CreditRegistryId  {get;set;}
}

EF不支持只使用参与复合键的关联的一个属性的关联。 不确定此场景是否可以实现