上课:
public class MarketTraitsDto
{
[DataMember(Order = 1)]
public int Id { get; set; }
...
[DataMember(Order = 18)]
public virtual ICollection<MarketTraitsDto> CompositeMarketTraits { get; set; }}
这是在EF6中配置的:
HasMany(mt => mt.CompositeMarketTraits)
.WithMany()
.Map(mtmt => mtmt.ToTable("MarketTraitsLink")
.MapLeftKey("ParentMarketTraitId")
.MapRightKey("ChildMarketTraitId"));
尝试了各种各样的事情,有人为我迷惑不解地建议使用ModelBuilder在EF Core中进行编译的正确方法!