1

Is it possible to unmap a property inherited from a parent-child subclass mapping in Fluent Nhibernate set up for separate tables?

Classes

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; }
}

Mappings

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?
    }
}
Petrus Theron
  • 27,855
  • 36
  • 153
  • 287

1 Answers1

0

I figured out I really want to share some common properties between two entities, not subclassing. The following question's answer talks about a BaseObjectMap:

Fluent Nhibernate How to specify Id() in SubclassMap

Community
  • 1
  • 1
Petrus Theron
  • 27,855
  • 36
  • 153
  • 287