It would be nice, if configuration of Envers were possible from Mapping-By-Code, for example.
Environment
None
Activity
Alex Zaytsev
January 28, 2016 at 9:01 AM
You will need to have an intermediate configuration. I will, probably, try to implement en solution or reference example, when I will have time.
Roger
January 19, 2016 at 3:06 PM
(First - my knowledge in mappingbycode is extremely low) Had a quick look. When trying to make extension method(s) like you did in your example, the interface (in this case IClassMapper<T>) lacks public information of what "context"/ModelMapper instance it belongs to.
When Envers is configured, an IMetaDataProvider is filled with information how entities are audited. This component has a one-to-one relationship to NH's Configuration object.
AFAIK, to make Envers and mapping-by-code work nicely together, there must be an one-to-one relationship between Envers' IMetaDataProvider and a "ModelMapper" (I assume this is the "top object" in mappingbycode?). That could be done, but then extension methods like "Audited()" in your example needs to be aware of what ModelMapper it belongs to.
Don't know if I make myself clear but if you have any good input, you're more than welcome to ping me here or on my mail (exists in NH user's list).
It would be nice, if configuration of Envers were possible from Mapping-By-Code, for example.