Print Page | Close Window

modelling many to many

Printed From: IdeaBlade
Category: DevForce
Forum Name: DevForce 2010
Forum Discription: For .NET 4.0
URL: http://www.ideablade.com/forum/forum_posts.asp?TID=2114
Printed Date: 07-Apr-2025 at 7:36pm


Topic: modelling many to many
Posted By: hueha
Subject: modelling many to many
Date Posted: 01-Sep-2010 at 9:06am
Do you have an example of a many to many mapping where the mapping table has a payload? I found a sample but it was for devforce 2009.  
Basically I have 3 tables.  Locations, Contacts and a mapping table LocationContacts
LocationContacts has locationcontactid (identity) and 2 FK LocationID, ContactID
I am trying to add a Contacts property in Location.  I would like this contacts list to be updated if I add a new contact at that location.
The other problem I have is that the LocationContacts list that was added automatically by devforce is behaving strangely.  It is returning all the locationContacts but for some reason the contactid is coming back as 0 - detached.
 



Replies:
Posted By: sbelini
Date Posted: 17-Sep-2010 at 8:35am
Hi,
 
You might want to take a look at http://drc.ideablade.com/xwiki/bin/view/Documentation/CreatingBusinessObjects#HAddingandRemovingItemsinCustom-CodedMany-to-ManyNavigationProperties - http://drc.ideablade.com/xwiki/bin/view/Documentation/CreatingBusinessObjects#HAddingandRemovingItemsinCustom-CodedMany-to-ManyNavigationProperties
 
Note that in the snippet the Create method is a static method on the Order partial class that you extend (you must write the code to handle the payload). In your .edmx model, right-click in the white area and select properties. Then, under DevForce Code Generation properties, set Generate Developer Classes to "True". This way entites partial classes will be automatically generated and you will be able to extend them.



Print Page | Close Window