More in this section

Forums / Developing with Sitefinity / Nolics: Linking Sitefinity users to module dbClasses

Nolics: Linking Sitefinity users to module dbClasses

7 posts, 0 answered
  1. Andy
    Andy avatar
    62 posts
    Registered:
    01 Aug 2008
    26 May 2009
    Link to this post
    I have a custom module for Projects. So I have a basic Nolics dbClass for the Project:
    dbclass Project [TableName = "sf_projects_Project"]  
        primary key string Application [50], guid ID [AutoGenGUID = True]; 
         
        string Title[50];                     
        string Number[20]; 
        string Status[50];  
        string Description[500];     
        date StartDate[Format="dd/mm/yyyy"]; 
        date EndDate[Format="dd/mm/yyyy"]; 
        int Cost[Nullable=True];  
             
        link Theme Parent: Application, guid ThemeID; 
         

    How do I link that to the Telerik.DataAccess.AspnetProviders.User?
  2. Andy
    Andy avatar
    62 posts
    Registered:
    01 Aug 2008
    26 May 2009
    Link to this post
    Sorry, to clarify, I need a project to be linked to one or more Sitefinity users.
    Each user will then have different access control rights over that project depending on their role.
  3. Vlad
    Vlad avatar
    498 posts
    Registered:
    19 Jun 2017
    26 May 2009
    Link to this post
    Hi Andy,

    Please look at the following forum thread as a hint to create a link to an external dbclass.
    As to creating many to many relations see the following topic in the Nolics online documentation:
    How to do <subject> in Nolics.net? > Miscellaneous How Do I topics > Many to many relations

    Greetings,
    Vlad
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Check out the tips for optimizing your support resource searches.
  4. Andy
    Andy avatar
    62 posts
    Registered:
    01 Aug 2008
    27 May 2009
    Link to this post
    Ok. I had problem with Nolics and Namespaces. The code auto-generated by Nolics from the dbclass seemed to 'forget' about 'using' the full path to Telerik.DataAccess.AspnetProviders. Maybe I did something in a wrong way. I did some manual tweaks and it's happier.

    I have a ProjectUsers 'link' class (as per the second link), and am just working on getting Project.Users as a list of User objects.
  5. Andy
    Andy avatar
    62 posts
    Registered:
    01 Aug 2008
    27 May 2009
    Link to this post
    OK. Another (maybe dumb) question.

    How do I get a Telerik.DataAccess.AspnetProviders.User by Guid?
  6. Vlad
    Vlad avatar
    498 posts
    Registered:
    19 Jun 2017
    28 May 2009
    Link to this post
    Hello Andy,

    The question is not dumb.
    Actually, we use Telerik.DataAccess.AspnetProviders.User object only internally in the membership provider implementation:

    namespace Telerik.DataAccess.AspnetProviders 
        public partial class Application 
        { 
        ... 
     
            internal User GetUserByPrimaryKey(Guid id) 
            { 
                User user = new User(); 
                user.UserId = id; 
                return (User)OdbClass.LoadByPrimaryKey(user, this.OdbProvider, ObDataCache.Current); 
            } 
     
     
            internal OdbDataProvider OdbProvider 
            { 
                get { return this.nn_provider; } 
            } 
     
        ... 
        } 
     

    Maybe you could use something similar in your code. However, I am not sure how it will behave in the context of your application.

    All the best,
    Vlad
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Check out the tips for optimizing your support resource searches.
  7. Andy
    Andy avatar
    62 posts
    Registered:
    01 Aug 2008
    28 May 2009
    Link to this post
    OK Vlad. I've got the Project-Users linked and displayed.
    I'm not sure I need to specifically get the User by ID now, but I will see what I can inherit/override from the Telerik.DataAccess.AspnetProviders.User.

    Thanks for the internal code. I also use RedGate's 'Reflector' tool to try to work out how some of the existing code goes, so I'll see what I can see with that.

    Thanks!
    Andy
Register for webinar
7 posts, 0 answered