c# - Automapper mapping generic types -
i have 2 generic types need map
public class a<t> { public list<t> results { get; set; } public int propertya { get; set; } public int propertyb { get; set; } }
and
public class b<t> { public list<t> resultcontent { get; set; } public int propertyc { get; set; } }
i've tried map b using automapper follows:
mapper.createmap(typeof(a<>),typeof(b<>)) .formember("resultcontent", f => f.mapfrom("results")) .formember("propertyc", f => f.mapfrom(?????))
it works fine resultcontent
property. however, issue b.propertyc sum of properties a.propertya , a.propertyb. possible compute mapping of properties generic types?
for have use converter
, resolveusing()
define operation performed.
see instance answer more details.
Comments
Post a Comment