EF Fluent Api仅提供.WithOne()但不提供.WithMany()?

时间:2017-10-31 17:33:58

标签: c# entity-framework ef-code-first

当我尝试映射具有多对多关系的2个表时,我只获得选项.WithOne()但没有得到.WithMany()? enter image description here

以下是这两个班级。

public class Proizvod
{
    public int Id { get; set; }
    public String Naziv { get; set; }
    public ICollection<Racun> Racuni { get; set; }

    public Proizvod()
    {
        this.Racuni = new List<Racun>();
    }

}

    public class Racun
{
    public int Id { get; set; }
    public List<int> Kolicina { get; set; }
    public ICollection<Proizvod> Proizvodi { get; set; }

    public Racun()
    {
        this.Proizvodi = new List<Proizvod>();
        this.Kolicina = new List<int>();
    }
}

0 个答案:

没有答案