Copied to clipboard

Flag this post as spam?

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


  • John Bergman 483 posts 1132 karma points
    May 04, 2017 @ 04:48
    John Bergman
    0

    “UDI” ids for unique relation between umbraco items

    Can anyone point me to documentation or notes related to this enhancement, I'd like to leverage this in our implementation.

  • Dave Woestenborghs 3504 posts 12135 karma points MVP 9x admin c-trib
    May 04, 2017 @ 08:30
    Dave Woestenborghs
    1

    Hi John,

    Haven't seen any documentation yet.

    But I have seen a lot of posts recently about it.

    Maybe this post can be help full : https://our.umbraco.org/forum/templates-partial-views-and-macros/85482-umbraco-76-api-model-issue-with-typedmedia

    you said you wanted to track relations between items. For that I would recommend my nexu package : https://our.umbraco.org/projects/backoffice-extensions/nexu/

    Dave

  • Claus Jensen 49 posts 157 karma points hq
    May 04, 2017 @ 08:47
    Claus Jensen
    2

    We unfortunately haven't gotten around to updating documentation yet on Udis, but basically a Udi is a identifier allowing you to uniquely identify an entity in Umbraco.

    It consists of a type part and a identifier part:

    umb://document-type/<guid here>
    

    So for example this string:

    umb://media-type/71ca447160b741af985d1e9b4ea64761
    

    would be a reference to this specific media type having that guid.

    A document reference could look like:

    umb://document/71ca447160b741af985d1e9b4ea64761
    

    You can see all the current possible types in here:

    https://github.com/umbraco/Umbraco-CMS/blob/dev-v7.6/src/Umbraco.Core/UdiEntityType.cs

    The great thing about referencing using Udi's is that they are entirely unique across multiple instances of your site - whereas the old integer ID's are only unique to the specific instance of the site itself. So a reference to nodeId=1050 would in most cases be something completely different if you transferred this directly over to a new instance of your site, whereas a reference using a Udi (guid) will always be the same for the same entity across multiple instances.

    The old way of referencing stuff would also require you to basically store what type of reference you are storing, as the reference itself (just an integer) doesn't contain any information about what this thing actually is. By using Udi's we can know just by looking at the reference, what kind of code we need to call to be able to look up this type of item when we need to resolve dependencies for example.

Please Sign in or register to post replies

Write your reply to:

Draft