More in this section

Forums / Developing with Sitefinity / Nolics - Many to many Query?

Nolics - Many to many Query?

3 posts, 0 answered
  1. Andy
    Andy avatar
    62 posts
    Registered:
    01 Aug 2008
    27 Jul 2009
    Link to this post

    I have a many-to-many relation of dbClasses:
    dbclass Project [TableName = "sf_projects_Project"]  
        primary key string Application [50], guid ID [AutoGenGUID = True];    
        string Title[50]; 
        relation ProjectKeyword(ParentProject)[] KeywordProjects[Groups = "ProjectKeywords"];     
     
    dbclass ProjectKeyword [TableName = "sf_projects_ProjectKeywords"
    {     
        primary key string Application [50], guid ID [AutoGenGUID = True]; 
        link Project ParentProject[Groups = "ProjectKeywords"]: Application, guid ProjectId;     
        link Keyword ChildKeyword[Groups = "ProjectKeywords"]: guid KeywordId;          
     
    dbclass Keyword [TableName = "sf_projects_Keywords"]  
        primary key string Application [50], guid ID [AutoGenGUID = True]; 
        string KeywordName[50];     
        relation ProjectKeyword(ChildKeyword)[] KeywordProjects[Groups = "ProjectKeywords"]; 
     

    I want to get all the Keywords for a Project, and I'm having trouble getting the right Query syntax
    query ProjectKeywords for Keyword [Group="ProjectKeywords"
        guid ProjectId = ????; 

    Can you give me a clue as to how to achieve this? I find the Nolics documentation a bit lacking!

    Thanks!




  2. Gabe Sumner
    Gabe Sumner avatar
    440 posts
    Registered:
    09 Sep 2007
    29 Jul 2009
    Link to this post
    Yep, it can be difficult to find Nolics details.

    I would caution against spending too much time learning Nolics.  Sitefinity 4.0 (which is admittedly serveral months from release) will replace Nolics with Telerik's OpenAccess ORM.  In the meantime, in my own projects, I've been using my own data access code or ORM-preference for my data-access layer. 

    This being said, I understand you might have requirements that prevent you from avoiding Nolics.  If that's the case, hopefully the team will have some guidance. 

    Gabe Sumner
    http://www.sitefinitywatch.com/

  3. Andy
    Andy avatar
    62 posts
    Registered:
    01 Aug 2008
    30 Jul 2009
    Link to this post
    Thanks Gabe,

    I've worked around it via code, it's just not as elegant.
    And, as you've guessed, I'm being forced to use the nolics layers. I'm learning, slowly, but manly by trial and error which is painful.
    Very much look forward to v4, though it's too late for this project.

    Cheers!
    Andy

Register for webinar
3 posts, 0 answered