是否可以取消从Fluent Nhibernate中为父子子类映射继承的属性为单独的表设置?
public class Parent
{
public int Id { get; set; }
public string Name { get; set; }
public int ParentOnlyProperty { get; set; }
}
public class Child : Parent
{
public string AnotherProperty { get; set; }
}
public class ParentMap : ClassMap<Parent>
{
public ParentMap()
{
Id(x => x.Id);
Map(x => x.Name);
Map(x => x.ParentOnlyProperty);
}
}
public class ChildMap : SubclassMap<Child>
{
public ChildMap()
{
Map(x => x.AnotherProperty);
Unmap(x => x.ParentOnlyProperty); // is something like this possible?
}
}
答案 0 :(得分:0)
我想我真的想在两个实体之间共享一些共同的属性,而不是子类化。以下问题的答案讨论了一个BaseObjectMap: