开发者

Mapping all entities by convention

开发者 https://www.devze.com 2023-04-01 15:19 出处:网络
I\'m playingwith NH 3.2.0 mapping by code. Since I\'ve a scenario in which I can map everithing b开发者_如何学Cy convention I would like to add raw entities to the mapper, and then customize them by a

I'm playing with NH 3.2.0 mapping by code. Since I've a scenario in which I can map everithing b开发者_如何学Cy 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.


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...

0

精彩评论

暂无评论...
验证码 换一张
取 消