Search code examples
nhibernatenhibernate-mapping-by-code

Mapping all entities by convention


I'm playing with NH 3.2.0 mapping by code. Since I've a scenario in which I can map everithing by convention I would like to add raw entities to the mapper, and then customize them by a custom ModelInspector plus the event generated by the ModelMapper. Unfortunately the ModelMapper apparently does not allow me to add entity dirctly, instead he want object implementing IConformistHoldersProvider, so I eventually end with pass empty classes implementing ClassMapping for each entity I want to map. Is there some smartest way to achieve the same ?

Thanks.


Solution

  • Well I found myself, problem was that I was using mapper.CompileMappingForAllExplicitlyAddedEntities(); the problem simply does not sussists if I use

     mapper.CompileMappingFor()
    

    and I pass the required entities...