Implementing a LEFT join using a lambda expression in LINQ to SQL and the Entity framework
We know that lambda expressions use the Join function in LINQ to SQL and the Entity framework to implement inner joins, so how can you implement a LEFT join in a lambda expression? The trick is to add a function DefaultIfEmpty function to the join, and in fact this function seems to only translate the inner join into a left join in LINQ, such as
The returned Joinresult contains db.table1s left join DB. The result of the table2s. If you want to implement right join to return the location of Db.table1s and Db.table2s, there seems to be no good way to implement full outer join in LINQ lambda expressions, if you really use full outer Join or honestly in the database write view or stored procedures ...
Implementing a LEFT join using a lambda expression in LINQ to SQL and the Entity framework