File tree Expand file tree Collapse file tree 1 file changed +6
-6
lines changed Expand file tree Collapse file tree 1 file changed +6
-6
lines changed Original file line number Diff line number Diff line change @@ -9,10 +9,10 @@ Configure a custom factory for the mapping of a particular type using:
99Mapper .WhenMapping
1010 .From <CustomerViewModel >() // Apply to CustomerViewModel mappings
1111 .ToANew <Customer >() // Apply to Customer creations
12- .MapInstancesUsing (( cvm , c ) => new Customer
12+ .MapInstancesUsing (ctx => new Customer
1313 {
14- Name = cvm . Forename + " " + cvm .Surname ,
15- Number = cvm .CustomerNo
14+ Name = ctx . Source . Forename + " " + ctx . Source .Surname ,
15+ Number = ctx . Source .CustomerNo
1616 });
1717```
1818
@@ -21,10 +21,10 @@ Configure a conditional custom factory using ([inline](/configuration/Inline) ex
2121``` cs
2222Mapper .Map (customerViewModel ).ToANew <Customer >(cfg => cfg
2323 .If ((cvm , c ) => cvm .Discount > 0 ) // Apply if view model Discount > 0
24- .MapInstancesUsing (( cvm , c , i ) => new Customer
24+ .MapInstancesUsing (ctx => new Customer
2525 {
26- Name = cvm . Forename + " " + cvm .Surname ,
27- Number = i ,
26+ Name = ctx . Source . Forename + " " + ctx . Source .Surname ,
27+ Number = ctx . ElementIndex ,
2828 HasDiscount = true
2929 }));
3030```
You can’t perform that action at this time.
0 commit comments