Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

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.

...