如何在实体框架的数据库中创建具有字段的外键字段?
DecodePersonnelID
我想在表MyUser
和PersonnelID
表Personnel
(字段键)之间创建关系。
public partial class MyUser
{
public int UsersID { get; set; }
public string PersonnelID { get; set; }
[NotMapped]
public int DecodePersonnelID
{
get { return DecodeMD5PersonnelID(PersonnelID); }
set { PersonnelID = EncodeMD5(value.ToString() ); }
}
public string UsersName { get; set; }
}
public partial class Personnel
{
public int PersonnelID { get; set; }
public string FirstNameFa { get; set; }
public string LastNameFa { get; set; }
public bool Gender { get; set; }
}