Multiple references between 2 objects

4 posts, 0 answers
  1. Stijn
    Stijn avatar
    4 posts
    Member since:
    Oct 2014

    Posted 20 Oct 2014 Link to this post

    I have a database model where class "TEAM" has a list of items of type "MEMBER", with a reverse navigation property in class "MEMBER" to "TEAM". Class "TEAM" also has 4 more references to specific instances of Class "MEMBER", for example 'TeamLeader', 'PublicRelations', etc ....". These 4 references don't have a specific reverse navigation property, as it'll always be the same as the one from the list.

    I can't get my code to work however. When adding 'IsManaged' to the list property, the list is properly managed, but the 4 other references behave in a bizarre way. When removing IsManaged from the list, the 4 single references work fine, but the List is not properly filled.

    I'm using the latest version of the NuGet packages.

    Kind regards,
    Stijn


  2. Boris Georgiev
    Admin
    Boris Georgiev avatar
    190 posts

    Posted 23 Oct 2014 Link to this post

    Hi Stijn,

    If I understand correctly your scenario and model you have two classes looking like this:

    class Team
    - Id - Property
    - TeamLeaderId - Property
    - PublicRelationId - Property
    - Members - Navigation
    - TeamLeader - Navigation
    - PublicRelation - Navigation

    class Member
    - Id - Property
    - TeamId - Property
    - Team - Navigation

    and Associations:
    Team.TeamLeaderId - Member.Id - 1:n
    Team.PublicRelation - Member.Id - 1:n
    Team.Id - Member.TeamId - n:1

    In this scenario, the navigation collection property Team.Members and the navigation reference properties Team.TeamLeader and Team.PublicRelation are based on different columns in the database, which means that the IsManaged collection could be impaired because there are 2 or more associations between these two classes. So in this case we would recommend you to not use IsManaged flag of the navigation collections and manage the navigation properties by your own.

    I hope that helps. If this is not your scenario, could you please share more details about your model?

    Regards,
    Boris Georgiev
    Telerik
     
    OpenAccess ORM is now Telerik Data Access. For more information on the new names, please, check out the Telerik Product Map.
     
  3. DevCraft banner
  4. Stijn
    Stijn avatar
    4 posts
    Member since:
    Oct 2014

    Posted 24 Oct 2014 in reply to Boris Georgiev Link to this post

    Hello

    Thanks for the response. So currently having Telerik manage the navigation properties when having multiple references is not possible. Is this however a bug or feature that might be fixed/added in future versions?

    Kind regards,
    Stijn
  5. Boris Georgiev
    Admin
    Boris Georgiev avatar
    190 posts

    Posted 24 Oct 2014 Link to this post

    Hello Stijn,

    This is a limitation of Telerik Data Access and at the moment supporting IsManaged for multiple relations between two classes is not in our backlog list.

    If any other questions arise, do not hesitate to contact us again.

    Regards,
    Boris Georgiev
    Telerik
     
    OpenAccess ORM is now Telerik Data Access. For more information on the new names, please, check out the Telerik Product Map.
     
Back to Top