1

如何在字段 DecodePersonnelID 和 PersonnelID 字段之间创建关系

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; }
}


RAYANContext db=new RAYANContext();
        var query = (from m in db.MyUsers
                     join p in db.Personnels on m.DecodePersonnelID equals p.PersonnelID
                     select new
                     {
                         m.UsersName,
                         p.FirstNameEn
                     }).ToList();

错误:LINQ to Entities 不支持指定的类型成员“DecodePersonnelID”。仅支持初始化程序、实体成员和实体导航属性。

4

0 回答 0