Mapping by convention
In large object models, you will notice that many aspects of the mappings are repetitive. Maybe the Comb generator should generate all POIDs or all properties referencing a class without an Id property should be treated as a component mapping. By setting up mapping conventions, you can potentially avoid all explicit mappings and instead let the code structure do the work for you.
Complete the Getting ready instructions at the beginning of this chapter.
How to do it…
- Add a folder named
- Add a class named
MyModelMapperto the folder:
using System.Collections.Generic; using System.Linq; using System.Reflection; using NH4CookbookHelpers.Mapping.Model; using NHibernate.Mapping.ByCode; ...