c# - Automapper Ignore Auto Flattening -
i have entity in legacy system has format
public guid id {get;set;} public int duration {get;set;} public bool durationtype {get;set;}
in viewmodel have following
public guid id {get; set;} public int duration {get;set;}
mapping entity view model works fine, when try , map viewmodel entity dies.
what appears doing trying call non existing property duration.type in reverse mapping (i.e it's trying auto-flatten). results in error cannot map int32 bool
.
does have suggestions on how disable auto-flattening in automapper or manually set fields maps happen using attributes.
to have ignore durationtype
property when mapping viewmodel
entity
add mapping configuration:
mapper.createmap<viewmodel,entity>() .formember(dest => dest.durationtype, options => options.ignore());
Comments
Post a Comment