0
I持って、次のクラス:Entity Framework 4.3で多対多リレーションシップを行うにはどうすればよいですか?
public class Entity
{
public long Id {get;set;}
}
public abstract class Base
{
public long Id {get;set;}
public abstract ICollection<Entity> Entities {get;set;}
}
public class Child : Base
{
public override ICollection<Entity> Entities {get;set;}
}
マッピング:
modelBuilder.Entity<Child>().Map(
m => {
m.ToTable("Children");
m.MapInheritedProperties();
});
modelBuilder.Entity<Child>().HasMany(m => m.Entities).WithMany();
私は次の例外を取得:
The navigation property 'Entities' is not a declared property on type
'EventCriteria'. Verify that it has not been explicitly excluded from the model
and that it is a valid navigation property.
私が間違っているのは何を?
実際、別のChildクラス「Child2」にマップされているChild2があります。TPTは使用しませんが、コンクリートタイプのテーブルを使用します。そのため、私はマップ継承プロパティを呼び出しました。 –