首页 > 解决方案 > 有没有办法二配置四路关系与两个二表

问题描述

我正在尝试迁移模型,但出现错误

由于关系约束,无法确定导航属性表示的关系。

我不知道如何配置这种关系

public class Currency
{
    public int Id { get; set; }

    public string Name { get; set; }

    public string Code { get; set; }

    public string Symbol { get; set; }      

    public string Notes { get; set; }

    public ICollection<ExchangeRate> ExchangeRates { get; set; }

    public virtual ICollection<ExchangeRate> QuotedExchangeRates { get; set; }
}


public class ExchangeRate
{
    public int Id { get; set; }      

    public DateTime Date { get; set; }

    public decimal Rate { get; set; }

    public DateTime UpdatedDate { get; set; }

    public Currency BaseCurrency { get; set; }

    public Currency QuoteCurrency { get; set; }
}

详情查看:

在此处输入图像描述

标签: c#entity-framework-core

解决方案


推荐阅读