Skip to content

Commit 804b92f

Browse files
committed
Updating documentation example
1 parent 6a72887 commit 804b92f

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

docs/src/configuration/Object-Mapping.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,10 @@ Configure a custom factory for the mapping of a particular type using:
99
Mapper.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
2222
Mapper.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
```

0 commit comments

Comments
 (0)