c# - Automapper foces subobjects to be mapped -
i trying map response object webservice class in project. thought automapper map sub objects automatically, not unless , until forcefully set member. why should ?
mapper.createmap<getifpquoteresponse.quote, quotewsmodel>() .formember(dest => dest.carrierrate, opt => opt.mapfrom(src => src.carriers)) .formember(dest => dest.droppedcarriers, opt => opt.mapfrom(src => src.droppedrates)) .formember(dest => dest.memberplans, opt => opt.mapfrom(src => src.memberplans));
why wont automapper map su bobjects when mention class mapping
mapper.createmap<getifpquoteresponse.quote, quotewsmodel>(); mapper.createmap<getifpquoteresponse.quote.carrier, carrierratemodel>(); mapper.createmap<getifpquoteresponse.quote.droppedcarrier, droppedcarriermodel>();
automapper map top level object.
if class built in following way not work:
class { b b; } class b { }
class not know how map property b inside class a.
to need create profile class.
Comments
Post a Comment