I Have a question about mapping in V8. I have a block editor property, that has a list of block types.
Now, I've created viewModels for the various blocks, that all inherit from a an interface that's only there so my page view model can have a property of List
However, I'm struggling to get the mapper to do a map from my collection of blocks to my ViewModels.
I'm trying to get it to do something like this: context.MapEnumerable<IPublishedElement, IBlock>(source.Tab1Contents.Select(a => a.Content));
I've defined mappings for all the types of Block IPublishedElements, mapping to the various implementations of Block, but it always error and says it doesn't know how to map them. I could map them by looping though my blocks and mapping each block individually, but it looks like I should be able to do what I'm after. Does anyone have any ideas?
Mapping Blocks using v8 Mapper
I Have a question about mapping in V8. I have a block editor property, that has a list of block types.
Now, I've created viewModels for the various blocks, that all inherit from a an interface that's only there so my page view model can have a property of List
However, I'm struggling to get the mapper to do a map from my collection of blocks to my ViewModels.
I'm trying to get it to do something like this:
context.MapEnumerable<IPublishedElement, IBlock>(source.Tab1Contents.Select(a => a.Content));
I've defined mappings for all the types of Block IPublishedElements, mapping to the various implementations of Block, but it always error and says it doesn't know how to map them. I could map them by looping though my blocks and mapping each block individually, but it looks like I should be able to do what I'm after. Does anyone have any ideas?
is working on a reply...