3
我嘗試了以下地圖:必須解析到頂級成員
CreateMap<ThemeNewModel, CreateThemeOrder.ThemeModel>()
.ForMember(d => d.Subject.Id, o => o.MapFrom(s => s.Subject));
兩個Subject.Id
和Subject
是int
類型。但是,我收到以下錯誤:
Expression 'd => Convert(d.Subject.Id)' must resolve to top-level member and not any child object's properties. Use a custom resolver on the child type or the AfterMap option instead.Parameter name: lambdaExpression
我正在使用AutoMapper 2.0。如果沒有AfterMap
,我不能解決這個問題嗎?