This project is read-only.

Overriding object creation behavior

Apr 22, 2010 at 10:05 AM

Hi. Emitmapper seems to use custom converters in the following way (according to ObjectsMapperBaseImpl.Map(...)):

  1. If custom converter is specified, it is called and its value is taken.
  2. Else a new object is constructed if needed and some default mapping is performed.

I would like my custom converter to be able invoke that default mapping. Is it possible?

Apr 25, 2010 at 5:31 PM

No, unfortunately in the current version true default mapping cannot be invoked inside converter (it is bug).

Mar 6, 2014 at 1:29 AM
Edited Mar 6, 2014 at 1:59 AM
I am also coming across a similar requirement in which I need to have some customizations done on the target type instance after it is created and before it's properties are set from the source type.
So, I want to override the point when Mapper creates instances of my target type and give it back the instantiated target type objects.

Is that possible to do somehow with EmitMapper?

Edit: I just noticed the Custom Converter section in the Documentations which does exactly what I wanted to do. So this question is already answered by that.