Up Query code samples
DevForce 2010 Resource Center » Code samples » Query code samples » Code sample: Many-to-Many (Silverlight)

Code sample: Many-to-Many (Silverlight)

Last modified on August 15, 2012 17:21

This code sample demonstrates how to perform basic operations with entities linked by a many-to-many relation.


Problem

Using join or linking tables in your database is a common practice, but how do you represent these relationships in your Entity Data Model, and then work with the entities in code?

Solution

A many-to-many relation can be with payload or without payload.  If the join table in the database contains no extra payload then the EDM Designer defines only an association in place of a "join entity".  If the table contains payload (i.e., additional properties other than the foreign keys) then an entity is created for the table.

The samples show how to navigate, add, and delete navigation properties in both scenarios where entities are linked by a many-to-many with payload or by a many-to-many without payload relationship. 

Note: While in the relationship with payload you must explicitly manipulate the linking table, that's not necessary in the many-to-many without payload relationship. 

Created by DevForce on March 03, 2011 15:06

This wiki is licensed under a Creative Commons 2.0 license. XWiki Enterprise 3.2 - Documentation. Copyright © 2015 IdeaBlade