EnrollTraineeという名前のテーブルがあります。EnrollTraineeモデルクラスに次の列があります。
[Key]
public int id { get; set; }
public int TraineeID { get; set; }
public int TrainerID { ![enter image description here][1]get; set; }
public virtual CreateUsers user_userid { get; set; }
public virtual CreateUsers user_id { get; set; }
public DateTime dt { get; set; }
これらの2つの列TraineeIDとTrainerIDは、テーブルCreateUserのUser_id列にマップされます。
これがCreateUserモデルクラスです
public class CreateUsers
{
[Key]
public int User_Userid { get; set; }
[Required]
[Display(Name="Enter User Name")]
public string User_name { get; set; }
[Required]
[Remote("IsDomainIDExist", "Account", ErrorMessage = "Domain ID Already Exist")]
[Display(Name = "Enter Domain ID")]
public string User_username { get; set; }
[Required]
[DataType(DataType.Password)]
[Display(Name = "Enter Password")]
public string User_password { get; set; }
[Required]
[Display(Name = "Enter Department")]
public string User_department { get; set; }
[Required]
[Remote("IsEmployeeIDExist", "Account", ErrorMessage = "Domain ID Already Exist")]
[Display(Name = "Enter Employee ID")]
public string User_employeeid { get; set; }
[Required]
[Display(Name="Select Role Type")]
public int RoleID { get; set; }
[Display(Name="Enable?")]
public bool User_Enable { get; set; }
[DataType(DataType.DateTime)]
[Display(Name = "Date Time")]
public DateTime dt { get; set; }
public virtual RoleModel Role { get; set; }
}
EF CFで同じ主キーを持つ2つの外部キーをマップするにはどうすればよいですか?