leftjoin-rightjoin-fulljoin-outerjoin
5.0.0
dotnet add package leftjoin-rightjoin-fulljoin-outerjoin --version 5.0.0
NuGet\Install-Package leftjoin-rightjoin-fulljoin-outerjoin -Version 5.0.0
<PackageReference Include="leftjoin-rightjoin-fulljoin-outerjoin" Version="5.0.0" />
<PackageVersion Include="leftjoin-rightjoin-fulljoin-outerjoin" Version="5.0.0" />
<PackageReference Include="leftjoin-rightjoin-fulljoin-outerjoin" />
paket add leftjoin-rightjoin-fulljoin-outerjoin --version 5.0.0
#r "nuget: leftjoin-rightjoin-fulljoin-outerjoin, 5.0.0"
#addin nuget:?package=leftjoin-rightjoin-fulljoin-outerjoin&version=5.0.0
#tool nuget:?package=leftjoin-rightjoin-fulljoin-outerjoin&version=5.0.0
leftjoin-rightjoin-fulljoin-outerjoin
Very simple Left/Right/FullOuterJoin extension methods for both IQueryable and IEnumerable types
In linq, if you need a left outer join, you have to use GroupJoin/Selectmany/DefaultIfEmpty blocks. There is another package in nuget containing similar extensions for only IEnumerable, which results in performance loss for database queries. For this need, I developed IQueryable versions.
Installation
Functionalities:
- Left Join for IQueryables: Translated into database queries
- Left Join for IEnumerables: In memory joining
- Left Excluding Join for IQueryable/IEnumerables: Taking only Left side for matching items
- Right Join for IQueryable
- Right Join for IEnumerable
- Right Excluding Join for IQueryable/IEnumerables
- Full Outer Join for IQueryable
- Full Outer Join for IEnumerable
- Left Join for IEnumerable via ON statement condition: other overloads uses lambdas for LEFT=> key and RIGTH ⇒ key syntax, this overload uses (LEFT, RIGHT) ⇒ boolean syntax
Usage
For IQueryable:
JOIN TYPE | METHOD NAME | Example | RETURN TYPE |
---|---|---|---|
LEFT JOIN | LeftJoinExt() | repository.GetAll().LeftJoinExt(roles, ur ⇒ ur.RoleId, role ⇒ role.Id) | IQueryable<JoinItem<TLeft, TRight>> |
LEFT EXCL JOIN | LeftExcludingJoin() | repository.GetAll().LeftExcludingJoinExt(roles, ur ⇒ ur.RoleId, role ⇒ role.Id) | IQueryable<JoinItem<TLeft, TRight>> |
RIGHT JOIN | RightJoinExt() | repository.GetAll().LeftExcludingJoinExt(roles, ur ⇒ ur.RoleId, role ⇒ role.Id) | IQueryable<JoinItem<TLeft, TRight>> |
RIGHT EXCL JOIN | RightExcludingJoinExt() | repository.GetAll().LeftExcludingJoinExt(roles, ur ⇒ ur.RoleId, role ⇒ role.Id) | IQueryable<JoinItem<TLeft, TRight>> |
INNER JOIN | InnerJoinExt() | repository.GetAll().InnerJoinExt(roles, ur ⇒ ur.RoleId, role ⇒ role.Id) | IQueryable<JoinItem<TLeft, TRight>> |
FULL JOIN | FullOuterJoinExt() | repository.GetAll().FullOuterJoinExt(roles, ur ⇒ ur.RoleId, role ⇒ role.Id) | IQueryable<JoinItem<TLeft, TRight>> |
FULL EXCL JOIN | FullOuterExcludingJoinExt() | repository.GetAll().FullOuterExcludingJoinExt(roles, ur ⇒ ur.RoleId, role ⇒ role.Id) | IQueryable<JoinItem<TLeft, TRight>> |
For IEnumerable:
JOIN TYPE | METHOD NAME | Example | RETURN TYPE |
---|---|---|---|
LEFT JOIN | LeftJoinExtEnumerable() | repository.GetAll().LeftJoinExtEnumerable(roles, ur ⇒ ur.RoleId, role ⇒ role.Id) | IEnumerable<JoinItem<TLeft, TRight>> |
LeftJoinExtEnumerable() | repository.GetAll().LeftJoinExtEnumerable(roles, ur ⇒ ur.RoleId, role ⇒ role.Id, (left, right)=> new {...}) | IEnumerable< TResult > | |
LEFT EXCL JOIN | LeftExcludingJoinExtEnumerable() | repository.GetAll().LeftExcludingJoinExtEnumerable(roles, ur ⇒ ur.RoleId, role ⇒ role.Id, (left, right)=> new {...}) | IEnumerable< TResult > |
RIGHT JOIN | RightJoinExtEnumerable() | repository.GetAll().RightJoinExtEnumerable(roles, ur ⇒ ur.RoleId, role ⇒ role.Id, (left, right)=> new {...}) | IEnumerable< TResult > |
RIGHT EXCL JOIN | RightExcludingJoinExtEnumerable() | repository.GetAll().RightExcludingJoinExtEnumerable(roles, ur ⇒ ur.RoleId, role ⇒ role.Id, (left, right)=> new {...}) | IEnumerable< TResult > |
INNER JOIN | InnerJoinExtEnumerable() | repository.GetAll().InnerJoinExtEnumerable(roles, ur ⇒ ur.RoleId, role ⇒ role.Id) | IEnumerable<JoinItem<TLeft, TRight>> |
repository.GetAll().InnerJoinExtEnumerable(roles, ur ⇒ ur.RoleId, role ⇒ role.Id, (left, right)=> new {...}) | IEnumerable< TResult > | ||
FULL JOIN | FullOuterJoinExtEnumerable() | repository.GetAll().FullOuterJoinExtEnumerable(roles, ur ⇒ ur.RoleId, role ⇒ role.Id, (left, right)=> new {...}) | IEnumerable< TResult > |
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net5.0 is compatible. net5.0-windows was computed. net6.0 was computed. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 was computed. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. |
-
net5.0
- No dependencies.
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
v3.2 fullouterjoin not working, fixed
v3.1 removed obsolete warnings, since they are well understood.
v3.0 All extensions got Ext prefix, to seperate from EntityFramework LeftJoin like methods.
v2.2 JointItem tostring method written
v2.1 LeftJoin.IEnumerable: Join with condition method added
v2.0 Linqkit and TResult projection for IQueryable removed. IQueryable methods now returning Tuples instead of TResult types given by the parameter Func