tags:

views:

179

answers:

3

Is there an exact opposite action to "join" in linQ to SQL? I want to display just the results that do not fulfill the inner join constraint from a query. I wanna do it just in one query. Here's an example of it's use (http://img165.imageshack.us/img165/4940/liststj3.jpg).

A: 

Check out Zip here:

http://www.codeplex.com/nextension

EDIT: might be better off doing "where !Collection.Contains(s.ID)" ...

ccook
+1  A: 

Bilal Haidar has an explanation on how to do a left outer join. Use this strategy and add a where condition to check where the object on the right hand side is null.

tvanfosson
+1  A: 

Falvarez's roles:

Roles.Where(r => r.Users.Any(u => u.Name == "falvarez"));

Roles that falvarez doesn't have

Roles.Where(r => !r.Users.Any(u => u.Name == "falvarez"));

Project each role into an object that knows whether falvarez is in that role

Roles.Select(r => new
  {
    FalvarezInRole = r.Users.Any(u => u.Name == "falvarez"),
    Role = r
  });

In the case that the role object doesn't have a users property, simply substitute a query that filters users by role in the place of r.Users

David B