Mapping inheritance

You will often have classes in your domain model that inherit from other classes. In our domain model, we have all classes representing a benefit inherited from the Benefit class. Following is a slimmed down version of the class diagram from our domain model representing this inheritance relationship:

Mapping inheritance

It is possible to map these classes to database tables as you would map any other class. But there are situations when you would want NHibernate to do more for you out of the box. One such situation involves polymorphic associations.

Polymorphic associations are associations where one of the ends is declared to be of base class type, ...

Get Learning NHibernate 4 now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.