Search code examples
c#nhibernatefluent-nhibernateautomapping

Fluent NHibernate automapper: skip an intermediate class w/ table-per-subclass


I'm using the Fluent NHibernate mapper with table-per-subclass to map the following structure:

public abstract class A
{
    // properties here
}

public abstract class B : A
{
    // methods here
}

public class C : B
{
    // properties here
}

My database only has tables to represent class A and class C. Class B exists only in my model for my convenience and doesn't contain any properties that needs to be mapped.

How can I get the automapper to skip B and map C as a subclass of A?


Solution

  • The Fluent NHibernate wiki has a section on ignoring base types when automapping that might be worth reading.