Search   

Friday, February 10, 2012

Support » Support Forum

Register  Login

 Menu  
 
    

 Welcome!  
 


Welcome to the NDO support forum!

kreis.gif Please register/login at the site if you want to post a thread. We sometimes copy support mails of common interest to the forum. They appear with anonymous sender.
kreis.gif Please post your messages in English language if possible. You can do your posts also in German, we will translate your post and our answer so that all users of the forum can read your posts.
kreis.gif The forum software requires that javascript is enabled.
kreis.gif Please do not insert licence information or licence keys in forum posts.
kreis.gif If you know a good answer to a post of another user, feel free to reply!
kreis.gif The forum is monitored. We reserve the right to remove posts we consider not to be useful for other forum users.

   Print   

      
 NDO Support Forum  
 
SearchForum Home
  NDO-Forum postings in english please, if possible.  Developing with NDO  Partlist with m...
 Partlist with multiple parents
 
 11/16/2006 4:19:36 PM
michael
5 posts


Partlist with multiple parents
Hallo Mirko! I tried to implement a structure like your partlist sample. A part can have many parts as children, and a part can have many parts as parents. Between two different classes such a relation (m:n) works fine. As a selfreference, like I need it, I have no idea how to solve the problem. I tried two named relations but this does not work. NDO creates no relation table. Do you have any idea? Thanks in advance, Michael
 12/7/2006 8:51:44 PM
Mirko
109 posts
5th


Re: Partlist with multiple parents

Hi Michael,

sorry for the late answer! I moved to another flat and that caused a lot of work.

If you write such a class, use a bidirectional relation, like this:

[NDOPersistent]
public class Person
{
[NDORelation(typeof(Person))]
List parents = new List();
[NDORelation(typeof(Person))]
List childs = new List();
...
}

Now NDO creates a mapping table and maps both relations to the same foreign key column IDPerson. That's only half of what we want. Start the mapping tool, open the node for the Person class and click at the child relation node. Enter IDParent as ForeignKeyColumnName. Then click at the MappingTable node beneath the child relation. Enter IDChild as ChildForeignKeyColumnName.

Now do the same procedure with the parent relation node, but enter IDChild as ForeignKeyColumnName and IDParent as ChildForeignKeyColumnName in the MappingTable node. Then the code works.

That's the good news. The bad new is, that due to a bug in the NDO.dll you'll get the wrong child objects if you do a query and navigate to the parents relation. Because of VS 2005 SP 1 we're in preparation of the NDO SP 2 to appear in a few days in which the bug will be fixed.

Best Regards
Mirko

 

  NDO-Forum postings in english please, if possible.  Developing with NDO  Partlist with m...
  SearchSearch  Forum HomeForum Home