This project is read-only.

Type-dependent member matching

Apr 23, 2010 at 10:57 AM

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

Apr 25, 2010 at 5:12 PM
Edited Apr 25, 2010 at 5: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 11: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?

Apr 26, 2010 at 11: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"