【发布时间】:2013-10-20 23:53:59
【问题描述】:
这里是这样,我有2个实体,比如Contract、Media。
public class Media : Entity
{
public string Name {get; set;}
public bool Enabled
*//other properties can be ignored..*
}
public class Contract : Entity
{
public string Code {get; set;}
*//other properties can be ignored..*
}
Contract 有很多 Media,看起来是多对多的。
但是!!首先在 ef 代码中,我需要 ContractMedia 表中的另外 3 个字段(ef 自动生成)。 例如开始日期、结束日期和价格。这些无法添加到媒体实体中。
在这种情况下如何映射??
【问题讨论】:
标签: c# entity-framework many-to-many