我想从Person实体访问多个虚拟实体。我想实现以下
public int ClientId { get; set; }
public virtual Person Client { get; set; }
public int PartnerId { get; set; }
public virtual Person Partner { get; set; }
如果有人知道如何使用ForiegnKey属性来定义它,请告诉我吗?
答案 0 :(得分:0)
像这样:
[ForeignKey("Client")]
public int ClientId { get; set; }
public virtual Person Client { get; set; }
[ForeignKey("Partner")]
public int PartnerId { get; set; }
public virtual Person Partner { get; set; }