Press Ctrl / CMD + C to copy this to your clipboard.
This post will be reported to the moderators as potential spam to be looked at
I am trying to accomplish nested mapping but I cant inject UmbracoMapper into my MappingDefinition.
Boot Failed!
Hopefully, this is a simple one - not sure if it is possible, might not be...
Answer is Current.Mapper.Map<> for anyone looking at this later
Current.Mapper.Map<>
See documentation
I found that this works too.
Map definitions are one for the outer order, and one for a line.
public void DefineMaps(IUmbracoMapper mapper) { mapper.Define<OrderReadOnly, PostOrderDto>((source, context) => new PostOrderDto(), Map); mapper.Define<OrderLineReadOnly, LineItem>((source, context) => new LineItem(), MapLine); }
Then the Map method itself for the order contains a mapping for the line items.
private void Map(OrderReadOnly source, PostOrderDto target, MapperContext context) { ... target.LineItems = context.MapEnumerable<OrderLineReadOnly, LineItem>(source.OrderLines); }
Slightly different to the previous answer as it uses the context value that is passed in.
is working on a reply...
Write your reply to:
Upload image
Image will be uploaded when post is submitted
UmbracoMapper Nested Mapping
I am trying to accomplish nested mapping but I cant inject UmbracoMapper into my MappingDefinition.
Boot Failed!
Hopefully, this is a simple one - not sure if it is possible, might not be...
Answer is
Current.Mapper.Map<>
for anyone looking at this laterSee documentation
I found that this works too.
Map definitions are one for the outer order, and one for a line.
Then the Map method itself for the order contains a mapping for the line items.
Slightly different to the previous answer as it uses the context value that is passed in.
is working on a reply...