Friday, 15 April 2011

c# - AutoMapper: Mapping child member from complex type to string[] -



c# - AutoMapper: Mapping child member from complex type to string[] -

i have destination type string[] property.

animal string[] barks;

my source object is:

animaldto list<barktypes> barks;

how map barktypes.nameofbark string[] barks?

something this:?

mapper.createmap<animaldto, animal>() .formember(dest => dest.barks, y => y.mapfrom(x=>x.??????))

you want resolveusing:

mapper.createmap<animaldto, animal>() .formember(dest => dest.barks, y => y.resolveusing(x=>x.barks .select(b=>b.nameofbark) .toarray()) )

c# automapper automapper-2

No comments:

Post a Comment