<?xml version="1.0" encoding="utf-8" ?>
<?xml-stylesheet type="text/xsl" href="RSS_xslt_style.asp" version="1.0" ?>
<rss version="2.0" xmlns:WebWizForums="http://syndication.webwiz.co.uk/rss_namespace/">
 <channel>
  <title>DevForce Community Forum : Add/Delete in many-to-many relationship</title>
  <link>http://www.ideablade.com/forum/</link>
  <description>This is an XML content feed of; DevForce Community Forum : DevForce 2009 : Add/Delete in many-to-many relationship</description>
  <pubDate>Thu, 21 May 2026 21:28:23 -700</pubDate>
  <lastBuildDate>Wed, 17 Feb 2010 16:22:44 -700</lastBuildDate>
  <docs>http://blogs.law.harvard.edu/tech/rss</docs>
  <generator>Web Wiz Forums 9.69</generator>
  <ttl>360</ttl>
  <WebWizForums:feedURL>www.ideablade.com/forum/RSS_post_feed.asp?TID=1647</WebWizForums:feedURL>
  <image>
   <title>DevForce Community Forum</title>
   <url>http://www.ideablade.com/forum/forum_images/IdeaBlade_logo_tm.png</url>
   <link>http://www.ideablade.com/forum/</link>
  </image>
  <item>
   <title>Add/Delete in many-to-many relationship : It depends upon whether your linking...</title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=1647&amp;PID=6219#6219</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://www.ideablade.com/forum/member_profile.asp?PF=4" rel="nofollow">GregD</a><br /><strong>Subject:</strong> 1647<br /><strong>Posted:</strong> 17-Feb-2010 at 4:22pm<br /><br />It depends upon whether your linking table has a payload or not.&nbsp; In NorthwindIB, the EmployeeTerritory has a payload and therefore the Entity Framework exposes the EmployeeTerritory linking entity explicitly in the model, and models two 1-to-many associations: Employee-&gt;EmployeeTerritory and Territory-&gt;EmployeeTerritory. If I understand what you're saying, you wrote a custom property in Employee to return the collection of related Territories. So you'll need another method somewhere that, given a Territory and an Employee, will create a new EmployeeTerritory entity to link them.<br><br>If your linking entity has no payload, then EF creates the many-to-many property for you on each entity, and then the Add() and Remove() methods on the collections of related entities will cause the new linking entity to get created behind the scenes.<br><br>Note that there's also an EmployeeTerritoryNoPayload table in NorthwindIB. If you use that instead of EmployeeTerritory you can see how the EF behaves when the linking entity has no payload.<br>]]>
   </description>
   <pubDate>Wed, 17 Feb 2010 16:22:44 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=1647&amp;PID=6219#6219</guid>
  </item> 
  <item>
   <title>Add/Delete in many-to-many relationship : Hi,  I have a many-to-many relationship...</title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=1647&amp;PID=6215#6215</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://www.ideablade.com/forum/member_profile.asp?PF=687" rel="nofollow">mit</a><br /><strong>Subject:</strong> 1647<br /><strong>Posted:</strong> 16-Feb-2010 at 11:59pm<br /><br />Hi,<br /><br />I have a many-to-many relationship similar with the one you have in Many-To-Many Associations in the Entity Framework pdf, for example Employee and Territory and the link table EmployeeTerritory. As explain in the pdf I created a property in Employee class and get the associated territories. So, I need to expose the Territories list in a grid and to add and delete entities to/from that grid.<br /><br />Can you tell me how can I add a new Territory entity to the Employee and how can I delete it? I tried to just create a new Territory with EntityManager.CreateEntity&lt;Territory&gt;() and to just add it to the Territories list, but it's not working.<br /><br />Thanks,<br /><br />Mit]]>
   </description>
   <pubDate>Tue, 16 Feb 2010 23:59:58 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=1647&amp;PID=6215#6215</guid>
  </item> 
 </channel>
</rss>