Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Tim 45 posts 199 karma points
    Oct 22, 2020 @ 20:52
    Tim
    0

    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?

  • This forum is in read-only mode while we transition to the new forum.

    You can continue this topic on the new forum by tapping the "Continue discussion" link below.

Please Sign in or register to post replies