Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Migrated to Confluence 5.3

Many to Many Relationships

This video covers the basics of many to many relationships in PLINQO. Check it out!

Widget Connector
width500
urlhttp://www.youtube.com/watch?v=ITp5xGaUuNQ&feature=player_embedded
height400310

Almost every project requires the use of many to many relationships and LINQ to SQL does not support it. As you probably guessed, PLINQO does! Let's go through a quick sample of a many to many scencario in PLINQO. Below is a diagram of a many to many relationship between the User and Role entities.

...

The code here adds a User to a Role.

...

Code Block
languagecsharp
using (var context = new TrackerDataContext())
{
    User u = context.User.GetByKey(1);
    Role r = context.Role.GetByKey(1);
    u.RoleList.Add(r);
    context.SubmitChanges();
}

...

 

The result in the database after the code is executed.

...

Read more about how PLINQO implemented many to many relationships.

Next: Query Extensions