0
AutoMapperを使用してOrderオブジェクトを取得しています。価格については、オブジェクトの拡張メソッドを使用して解決し、計算のためにPriceType
とMarkup
を渡す必要があります。
現在、私はそれは私がマークアップに渡す必要がちょうどPriceType
AutoMapper:2つの要素を解決コンテキストに渡す
//in the mapping
.ForMember(d => d.TotalPrice, opt => opt.ResolveUsing((src, dest, destMember, resContext) => dest.TotalPrice= src.UserTotalPrice((string)resContext.Items["Pricing"])))
//pass in the variable
var s = Mapper.Map<Order, NewOrder>(order, opts => opts.Items["Pricing"] = "A");
のために働いてきた
//in the mapping
.ForMember(d => d.TotalPrice, opt => opt.ResolveUsing((src, dest, destMember, resContext) => dest.TotalPrice= src.UserTotalPrice((string)resContext.Items["Pricing"]),(decimal)resContext.Items["Markup"]))
質問:私はそれを渡すことで2つの要素を設定できますか?
var s = Mapper.Map<Order, NewOrder>(order, opts => opts.Items["Pricing"] = "A"**********missing code**************);