我有 2 个实体:
public class School
{
public int Id { get; set; }
...
public virtual ICollection<Seminar> Seminars { get; set; }
}
public class Seminar
{
public int Id { get; set; }
...
public virtual ICollection<School> Schools { get; set; }
public virtual ICollection<Price> Prices { get; set; } // wrong??
}
public class Price
{
public int Id { get; set; }
public decimal Value { get; set; }
public virtual School School { get; set; }
public virtual Seminar Seminar { get; set; }
}
如何映射“价格”属性以获得如下内容:
var priceOfSomeSeminar = someSchool.Seminars[0].Price
可能吗?所以我想我需要帮助建立 Fluent API modelBuilder 关系......