Copied to clipboard

Flag this post as spam?

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


  • Craig Rowe 22 posts 175 karma points
    Aug 17, 2016 @ 14:33
    Craig Rowe
    0

    Modelling relationships between documents

    As I see it there are three possible ways to model relationships between instances of Document Types:

    Tree Parent/Child Relationship

    • Use tree to find ancestors/children
    • Can have only one parent
    • Can only relate documents to documents

    Parent with MNTP children

    • Can retrieve children easily, requires full node search to find parents
    • Allows relations to members
    • Can have multiple parents

    Parent with Relation children

    • Can use RelationService to retrieve either side of relationship
    • Can have multiple parents
    • Allows relations to members
    • Has no built in backoffice pickers (requires nuPickers?)
    • Very little mention in umbraco documentation or on umbraco.tv

    Are the above pros/cons correct? are there other easons I'm missing as to why I would choose one approach over another when modelling related entities.

    Why do Relations seem so 'hidden' in terms of tutorials/support/videos on umbraco official sites - simply because they are used less? or because it's intended people move away from them?

  • Ian 178 posts 752 karma points
    Aug 17, 2016 @ 22:43
    Ian
    0

    Most of.the time i do use a repository pattern with parent / children. When i've needed them.though i have found relations very useful. I think it is just that relations have really been one of those things neglected by the documentation. This means people don't understand what they are and how to use them and they fall into a bit of a terminal decline. As far as i know there are no plans to end their use and i've seen people use the alternatives you mention in wholly inappropriate situations where relations would be much better.

    Nupickers are as you say the defacto editor and i really like them. Its a shame there aren't more editors for the currrnt versions of wordpress.

    As always which route you choose is dependant on which solves your requirements in the simplest way

  • Nicholas Westby 2054 posts 7103 karma points c-trib
    Aug 18, 2016 @ 00:51
    Nicholas Westby
    0

    I haven't found much need for these types of relationships anymore, though I've never used the relations feature (as you mention, it seems to be a second-class citizen in the Umbraco world, for whatever reason).

    I used to use the tree parent/child relationship for things like slideshows, but now I just use Archetype to embed the slides directly into a property.

    For things like articles that have a page that lists them all, I usually just fetch every article in the entire site and cache that collection in memory.

    For instances where I need to display particular items, I usually have a MNTP. It's rare that I need to map in the opposite direction too.

Please Sign in or register to post replies

Write your reply to:

Draft