I've created this with LINQ
var main = (from p in participants
from cc in participants
where cc.Id != p.Id
select new { Id1 = p.Id, Id2 = cc.Id });
I was able to recreate it to..
var main = participants.SelectMany(n => participants, (x, y) => new { Id1 = x.Id, Id2 = y.Id })
.Where(x => x.Id1 != x.Id2).ToList();
Same think I want to do with...
var test = (from m in main
join cr in db.ContactRelations on new { Id1 = m.Id1, Id2 = m.Id2 } equals new { Id1 = cr.ContactId, Id2 = cr.RelationContactId } into tt
from cr in tt.DefaultIfEmpty()
select new { m.Id1, m.Id2, found = cr == null ? false : true }).ToList();
So far, It's not left join but only join.. and that null values is what I need..
var test = main.Join(db.ContactRelations,
c => new { Id1 = c.Id1, Id2 = c.Id2 },
x => new { Id1 = x.ContactId, Id2 = x.RelationContactId },
(c, x) => new { c.Id1, c.Id2, found = x == null ? false : true }).ToList();
Is possible to implement DeafultIfEmpty() somehow ?
Thanks..