0

I am trying to map a simple, plain source object to a destination object which implements an interface (IFeatureClass) and only has a public method named SetValue(index, value) for setting the destination 'properties'.

I want to be able to dynamically map my objects (DTOs/BOs) to objects implementing IFeatureClass. The index of the field can be found using another method of the interface called FindField(string fieldname) which returns the index of the field.

Do you think that it is possible to use AutoMapper or ValueInjecter to do this kind of job. Or is there any Pattern or something out there which will help me to do this? If so, could you please tell me how to do it? I checked the documentations and existing examples, but I can't find an example that matches my need.

Regards, Christian

Christian Junk
  • 1,000
  • 1
  • 8
  • 22

1 Answers1

0

I use Automapper to do this now. It works great. It haven't come across two objects I could map with it.

chrislhardin
  • 1,747
  • 1
  • 28
  • 44
  • Are you mapping properties to properties or properties to method calls? If so do you have a short example? – Christian Junk Oct 28 '12 at 17:22
  • I'm not where I can get at my samples but Automapper has the ability to create a TypeConverter for complex scenarios. Look at the wiki for it, I got my examples from there and on SO – chrislhardin Oct 28 '12 at 17:25