Copied to clipboard

Flag this post as spam?

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

  • steschu 85 posts 473 karma points
    Feb 04, 2022 @ 11:47

    Technical Difference Document Type and "Composition"


    When I right click "Document Types" unter Settings I can add Document Type, Element Type and Composition.

    Is there any technical difference between adding a Document Type and a Composition (except the Icon)? I only see a technical difference when adding an Element Type, which is the checked "Is an element type" option that leads to not beeing allowed selecting a template and child types.

    Kind regards, Stephan

  • Nik 1517 posts 6705 karma points MVP 5x c-trib
    Feb 04, 2022 @ 12:28

    Hi Stephan,

    The technical difference comes into play a bit further down the line to be honest. A Composition should be considered like an interface from a coding perspective. Document types can be composed of multiple compositions, however you cannot compose a doc type from another doc type.

    You also cannot compose a doc type from a composition that composes of another composition (bit more like an abstract class in this instance).

    Compositions feed into how the Models Builder models are generated as well, so you will see them as interfaces in the outputs.

    I would also advise that Compositions don't have templates.

    I don't believe the Umbraco back office differentiates that much between Compositions and Doc Types, so you could "technically" let a composition be created in the content tree, it is down to you and your setup of the site to prevent it.

    I hope that helps?


  • steschu 85 posts 473 karma points
    Feb 04, 2022 @ 13:33

    Thanks for the info, I understand the point with the Interface. But that actually comes into play only when deciding to use the Compositions button enter image description here

    I looked at the generated code. I the initial act of adding a Document Type or a Composition to the tree there doesn't seem to be a difference, both is compiled to classes.

    In the moment you decide to use these classes in compositions an Interface is generated in addition to that.

    So the reason why Document Type and Composition are shown as separate items in the context menu is just a help for the user, I think.

    Actually you can also inherit a Document Type from another Document Type (but only from ONE as it is possible in C# class inheritance) by selecting the three 3 dots of a document type and then "Create".

  • Marc Goodson 1718 posts 11411 karma points MVP 7x c-trib
    Feb 06, 2022 @ 22:35
    Marc Goodson

    Hi @steschu

    You are right the outcomes of two menu items are technically the same..

    A Document Type only becomes a Composition when you use it as one...

    But Composition is on that menu mainly to introduce the concept of composing Document Types, which otherwise isn't really introduced anywhere...

    ... I wrote a bit of a blog post at the time that contained some of the thinking surrounding the reorganisation...



Please Sign in or register to post replies

Write your reply to: