Copied to clipboard

Flag this post as spam?

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


  • Hefin Jones 38 posts 160 karma points
    Jan 30, 2014 @ 12:12
    Hefin Jones
    0

    Check if node has a relation?

    Good morning all,

    Most of the websites I work on require bi-lingual capabilities, and as part of this we have some code which will copy any content created in the "root" language across to all other language sites that have been related to the root language.  In version 6, I used the following code to check if a node had a relation:

    var relationService = ApplicationContext.Current.Services.RelationService;
    if (relationService.GetByParentId(content.Id).Where(x => x.RelationType.Alias == "relateDocumentOnCopy").Count() == 0 && content.Level > 1) {
    // do something
    }

    But this doesn't seem to work in v7 - has anything changed in the API that I need to be aware of?  If I try the same code in v7 - I don't get the ".Where( .... )" option - only ".WhereNotNull<>".  Any help would be greatly appreciated!

    Thanks

  • Hefin Jones 38 posts 160 karma points
    Jan 31, 2014 @ 12:50
    Hefin Jones
    100

    Schoolboy Error!  I had accidentally removed the:

    using System.Linq;

    declaration from my class file! Duh!

  • 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