EF Core 支持属性包实体上的导航还是指向属性包实体的实体上的导航?
有这门课
public class PropertyBagEntityDetail
{
public string StringProperty { get; set; }
public Dictionary<string, object> Parent { get; set; }
}
我试过了:
protected override void OnModelCreating(ModelBuilder modelBuilder)
{
modelBuilder.SharedTypeEntity<Dictionary<string, object>>("PropertyBagEntity", bb =>
{
bb.Property<int>("IntProperty");
bb.Property<string>("StringProperty");
bb.Property<DateTime>("DateTimeProperty");
});
modelBuilder.Entity<PropertyBagEntityDetail>().HasOne(itm => itm.Parent).WithMany();
}
或者这个:
protected override void OnModelCreating(ModelBuilder modelBuilder)
{
modelBuilder.SharedTypeEntity<Dictionary<string, object>>("PropertyBagEntity", bb =>
{
bb.Property<int>("IntProperty");
bb.Property<string>("StringProperty");
bb.Property<DateTime>("DateTimeProperty");
bb.HasMany<PropertyBagEntityDetail>("Details").WithOne(itm=>itm.Parent);
});
}
两者都返回
无法将导航“详细信息”添加到实体类型“PropertyBagEntity (Dictionary
有什么方法可以实现吗?