score:0

Accepted answer

You can try to do it using SelectMany extension method:

var result1 = await  dbContext.Emails
                    .SelectMany(e=>dbContext.Sms.Where(s=>e.PNID==From_PNID.Value 
                                                       || e.PNID==To_PNID.Value)
                                                .Select(e=>new {Email=e,SMS=s})).ToListAsync();

score:0

LINQ Inner Join with OR condition Example::

             var q= await  dbContext.Emails
             .SelectMany(e=>dbContext.Sms.Where(s=>e.PNID==From_PNID.Value 
                                    || e.PNID==To_PNID.Value)
                                    .Select(e=>new {Email=e,SMS=s})).ToListAsync();

try this example!!

score:-1

You can use conventional LINQ instead of LINQ expression.

e.g.

     var records = (from recordA in TableA 
                    from recordB in TableB 
                    where recordA.Column_1 == recordB.Column_1 || recordA.Column_2 == recordB.Column_2
                   ).ToList();

Related Articles