In Entity Framework Core 10, the Left Outer Join and the Right outer Join

Only.NET 10 (or above) is required to use Entity Framework 10, which was released in November 2025 with LST (Long Term Support). Among the numerous enhancements in EF 10 is the eagerly anticipated support for outer joins via the new LINQ operators LeftJoin and RightJoin.

Quick refresh – Inner Join Vs Outer Join

  • Inner Join – Return matches only
  • Left Outer Join – Return all rows from the left with matches from the right and null when no match found
  • Right Outer Join – – Return all rows from the right with matches from the left and null when no match found

Way to write Outer join before EF 10

Before EF 10, the way to write a left outer join was to use a group join followed by DefaultIfEmpty(). This is the pattern that maps to a SQL LEFT JOIN.

Example: Consider the following table relationship between the Employee and Department tables, where the Employee table has an optional DepartmentId column

The following query shows an equivalent left outer join in EF (prior to EF 10). This is the canonical way to write a left join in EF Core.

You can also, write left join using group join followed by DefaultIfEmpty().

SQL Generated in above two cases.

Entity Framework (prior to EF 10) does not support a native right outer join operator, but you can achieve it by swapping the tables.

Following is SQL Rule and EF is also following same rule

EF Core 10: the new LeftJoin and RightJoin LINQ Operators

EF Core 10 (with .NET 10) introduced two new LINQ operators, LeftJoin and RightJoin, allowing your code to read more like SQL. EF Core translates these into SQL LEFT JOIN and RIGHT JOIN statements.

Considering the above-mentioned example, the left outer join query looks as follows with LeftJoin operator:

If there is a relationship between tables based on more than two columns, you can write the query in the following way.

Considering the above-mentioned example, the right outer join query looks as follows with RightJoin operator:

SQL Generated

Wrap-up

  • It is recommended to use the new LeftJoin and RightJoin operators in EF Core 10 for clearer code.
  • EF Core 10 still supports the earlier approach to writing left joins—using a group join followed by DefaultIfEmpty()—to maintain backward compatibility with older .NET frameworks.
  • You can inspect your generated SQL using ToQueryString() method

Best and Cheap Entity Framework Core 10 Hosting

To help you find the best Windows hosting provider that fully support Entity Framework, we will give you our recommendation. After we had reviewed 50+ providers, we found that ASPHostPortal is one of the best. They have expert ASP.NET support who always ready to help your problem, although with 99.99% uptime we think you won’t get any problem.

ASPHostPortal.com is Microsoft No #1 Recommended Windows Hosting Partner ASPHostPortal.com is Microsoft No #1 Recommended Windows and ASP.NET Spotlight Hosting Partner in United States. Microsoft presents this award to ASPHostPortal.com for the ability to support the latest Microsoft and ASP.NET technology, such as: WebMatrix, WebDeploy, Visual Studio 2012, .NET 4.5.2/ASP.NET 4.5.1, ASP.NET MVC 6.0/5.2, Silverlight 5 and Visual Studio Lightswitch.

You may also like...

Popular Posts