Type-dependent member matching

Apr 23, 2010 at 9:57 AM

Is it possible to match members in different ways for different types being mapped?

Coordinator
Apr 25, 2010 at 4:12 PM
Edited Apr 25, 2010 at 4:12 PM

Yes, it is possible. The simplest way is to use method "MatchMembers". Inside matching delegate you can analyse member info via reflection. 

Apr 26, 2010 at 10:37 AM

But (since MatchMembers only has access to members' names) this requires that I know the exact classes, whoose members are being mapped. Am I right?

Coordinator
Apr 26, 2010 at 10:54 AM

Yes. I will fix it. Another way is to implement a custom mapping configurer, but it is rather difficult. You can take as exmaple class "DefaultMapConfig" copy\paste it's code and modify method "protected virtual bool MatchMembers(string m1, string m2)" and use instance of this class as parameter for method "ObjectMapperManager.GetMapper"