2017-09-08 11 views
0

AutoMapperを使用してOrderオブジェクトを取得しています。価格については、オブジェクトの拡張メソッドを使用して解決し、計算のためにPriceTypeMarkupを渡す必要があります。
現在、私はそれは私がマークアップに渡す必要がちょうどPriceTypeAutoMapper: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**************); 

答えて

1
opts => 
{ 
    opts.Items["Pricing"] = "A"; 
    opts.Items["Markup"] = 12; 
} 
関連する問題