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 39 posts 161 karma points
    Jan 30, 2014 @ 12:12
    Hefin Jones

    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!


  • Hefin Jones 39 posts 161 karma points
    Jan 31, 2014 @ 12:50
    Hefin Jones

    Schoolboy Error!  I had accidentally removed the:

    using System.Linq;

    declaration from my class file! Duh!

Please Sign in or register to post replies

Write your reply to: