Copied to clipboard

Flag this post as spam?

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


  • andrew shearer 409 posts 517 karma points
    Nov 04, 2020 @ 03:57
    andrew shearer
    0

    built in UmbracoMapper: ability to "auto map"?

    Hello

    I’m looking into the UmbracoMapper https://our.umbraco.com/documentation/Reference/Mapping/ (not to be confused with the UmbracoMapper package by Andy Butland of the same name) and wondered if it does any property automapping by convention? It seems that you have to “DefineMaps” for everything?

    The docs say “works in ways very similar to AutoMapper” but I can’t get to automatically map properties between source and target of the same name/type.

    Does it actually automap?

    Thanks Andrew

    (using umbraco 8.9)

  • andrew shearer 409 posts 517 karma points
    Nov 04, 2020 @ 20:09
    andrew shearer
    0

    actually, maybe this explains what im asking: (from further down the page https://our.umbraco.com/documentation/Reference/Mapping/)

    The analyzer verifies that every publicly settable property of target is assigned a value. If a property is not assigned a value, the tool raises a build error (ie. the code will not compile).

    Since, contrary to AutoMapper, mapping is not implicit nor automatic, this ensures that, should a new property be added to ISource, an error would be raised until the corresponding mappings are updated.

    I probably don't understand the advantage/purpose of a mapper that requires you to be explicit about every property mapping. I could write that code without umbracomapper?

    some insight would be appreciated :)

  • 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