Is it possible to write lambda left join on multiple columns that would generate OR condition instead of AND?
var query = context.table1.GroupJoin(
context.table2,
x => new { JoinCol1 = x.CustomerCode, JoinCol2 = x.CustomerName},
y => new { JoinCol1 = y.Code, JoinCol2 = y.Name},
(x, y) => new {
firstTable = x,
secondTable = y
}).SelectMany(
x => x.OrganizationAddress.DefaultIfEmpty(),
(x, y) => {
x.firstTable.field1,
x.firstTable.field2,
y.Field3,
y.Field4
}
)
This will generate following query
SELECT t1.filed1, t1.field2, t2.field3, t2.field4
FROM table1
LEFT JOIN table2 ON table1.CustomerCode = table2.Code
AND table1.CustomerName = table2.Name
I would like to get the same query but instead of AND condition I want it to be OR:
SELECT t1.filed1, t1.field2, t2.field3, t2.field4
FROM table1
LEFT JOIN table2 ON table1.CustomerCode = table2.Code
OR table1.CustomerName = table2.Name
Is there a way to achieve this?
EDIT: version - EF 6.2.0