单个实体中的多个外键关系

时间:2017-12-31 05:09:15

标签: entity-framework entity-framework-6 ef-code-first

我需要在单个实体中配置多个外键1:1关系,我已经经历了这么多帖子,请查看以下代码供您参考。请帮我在实体框架中配置相同的内容。

public class Institution
{
    public Institution()
    {
        InstitutionId = Guid.NewGuid().ToString("N");
    }
    public string InstitutionId { get; set; }
    public string InstutionName { get; set; }
    public string BackgroundImage { get; set; }
    public string InstitutionCode { get; set; }
    public int Logo { get; set; }

    public string AddressId { get; set; }
    [ForeignKey("AddressId")]
    public virtual Address Address { get; set; }

    public string ServerId { get; set; }
    [ForeignKey("ServerId")]
    public virtual Server InstitutionServer { get; set; }
}

提前致谢,

0 个答案:

没有答案