Copied to clipboard

Flag this post as spam?

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


  • Richard Thompson 100 posts 336 karma points
    Jan 07, 2016 @ 13:01
    Richard Thompson
    0

    Mapping Media Picker

    Hi,

    My document type has some properties of type media picker. They are custom media types but I'm only interested in the standard properties provided by MediaFile.

    I've got the following in my model:

    public MediaFile ImageCover { get; set; }
    

    I was hoping it would map the media node ID to a MediaFile instance but it just returns null.

    Should this work or do I need to create a custom mapping?

  • Andy Butland 422 posts 2333 karma points MVP 4x hq c-trib
    Jan 07, 2016 @ 13:30
    Andy Butland
    1

    Would be quite nice if that did just work I agree... will give it some thought. But for now it'll need a custom mapping yes - Umbraco Mapper needs to be told how to map a given complex type like this.

  • Andy Butland 422 posts 2333 karma points MVP 4x hq c-trib
    Jan 09, 2016 @ 20:32
    Andy Butland
    1

    As I said, this seemed a good idea for something that should just work by default, so I've added support for this. If you'd like to take a look at version 1.6.1 from NuGet, our or GitHub you should find this works without having to add a custom mapping.

    Do let me know please if you try this and spot any issues, but looks OK in my tests.

    Andy

  • Richard Thompson 100 posts 336 karma points
    Jan 10, 2016 @ 12:40
    Richard Thompson
    0

    Hi Andy,

    I've tested this and it works perfectly. Many thanks for adding this.

    Richard

Please Sign in or register to post replies

Write your reply to:

Draft