Skip to content

Commit ac688cf

Browse files
committed
Fix LeftJoin for .NET 10
1 parent 33505e2 commit ac688cf

21 files changed

Lines changed: 418 additions & 280 deletions

File tree

.github/workflows/main.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ jobs:
4545
4646
- name: Run Tests
4747
run: |
48+
dotnet test ./tests/LinqKit.Core.Tests/LinqKit.Core.Tests.csproj -c ReleaseForGithubActions
4849
dotnet test ./tests/LinqKit.Tests/LinqKit.Tests.csproj -c ReleaseForGithubActions
4950
dotnet test ./tests/LinqKit.EntityFramework.Tests.Net452/LinqKit.EntityFramework.Tests.Net452.csproj -c ReleaseForGithubActions
5051
dotnet test ./tests/LinqKit.Microsoft.EntityFrameworkCore31.Tests -c ReleaseForGithubActions

LinqKit Solution.sln

Lines changed: 29 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,17 @@
11

22
Microsoft Visual Studio Solution File, Format Version 12.00
33
# Visual Studio Version 18
4-
VisualStudioVersion = 18.0.11201.2 d18.0
4+
VisualStudioVersion = 18.0.11201.2
55
MinimumVisualStudioVersion = 10.0.40219.1
66
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{2F7F283D-5576-417F-A467-EC210226AC3B}"
77
EndProject
88
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{9FC09568-C879-47D8-9D28-E736B8A84C95}"
99
ProjectSection(SolutionItems) = preProject
10+
.github\workflows\CreateRelease.yml = .github\workflows\CreateRelease.yml
1011
Directory.Build.props = Directory.Build.props
1112
Generate ReleaseNotes.bat = Generate ReleaseNotes.bat
1213
LICENSE = LICENSE
14+
.github\workflows\main.yml = .github\workflows\main.yml
1315
NuGet.txt = NuGet.txt
1416
PackageReleaseNotes.template = PackageReleaseNotes.template
1517
PackageReleaseNotes.txt = PackageReleaseNotes.txt
@@ -117,6 +119,14 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "LinqKit.Microsoft.EntityFra
117119
EndProject
118120
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "LinqKit.Microsoft.EntityFrameworkCore10.Tests", "tests\LinqKit.Microsoft.EntityFrameworkCore10.Tests\LinqKit.Microsoft.EntityFrameworkCore10.Tests.csproj", "{6700F0EC-ABC9-6321-9501-6F87C2B62AAD}"
119121
EndProject
122+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "LinqKit.Core.Tests", "tests\LinqKit.Core.Tests\LinqKit.Core.Tests.csproj", "{D6F5850C-F40D-2A48-578B-7B3F15C31F71}"
123+
EndProject
124+
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "GitHub Actions", "GitHub Actions", "{2A7B6550-F4EA-4ACE-B659-F262C2FF860E}"
125+
ProjectSection(SolutionItems) = preProject
126+
.github\workflows\CreateRelease.yml = .github\workflows\CreateRelease.yml
127+
.github\workflows\main.yml = .github\workflows\main.yml
128+
EndProjectSection
129+
EndProject
120130
Global
121131
GlobalSection(SolutionConfigurationPlatforms) = preSolution
122132
Debug|Any CPU = Debug|Any CPU
@@ -740,6 +750,22 @@ Global
740750
{6700F0EC-ABC9-6321-9501-6F87C2B62AAD}.Release|x64.Build.0 = Release|Any CPU
741751
{6700F0EC-ABC9-6321-9501-6F87C2B62AAD}.Release|x86.ActiveCfg = Release|Any CPU
742752
{6700F0EC-ABC9-6321-9501-6F87C2B62AAD}.Release|x86.Build.0 = Release|Any CPU
753+
{D6F5850C-F40D-2A48-578B-7B3F15C31F71}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
754+
{D6F5850C-F40D-2A48-578B-7B3F15C31F71}.Debug|Any CPU.Build.0 = Debug|Any CPU
755+
{D6F5850C-F40D-2A48-578B-7B3F15C31F71}.Debug|ARM.ActiveCfg = Debug|Any CPU
756+
{D6F5850C-F40D-2A48-578B-7B3F15C31F71}.Debug|ARM.Build.0 = Debug|Any CPU
757+
{D6F5850C-F40D-2A48-578B-7B3F15C31F71}.Debug|x64.ActiveCfg = Debug|Any CPU
758+
{D6F5850C-F40D-2A48-578B-7B3F15C31F71}.Debug|x64.Build.0 = Debug|Any CPU
759+
{D6F5850C-F40D-2A48-578B-7B3F15C31F71}.Debug|x86.ActiveCfg = Debug|Any CPU
760+
{D6F5850C-F40D-2A48-578B-7B3F15C31F71}.Debug|x86.Build.0 = Debug|Any CPU
761+
{D6F5850C-F40D-2A48-578B-7B3F15C31F71}.Release|Any CPU.ActiveCfg = Release|Any CPU
762+
{D6F5850C-F40D-2A48-578B-7B3F15C31F71}.Release|Any CPU.Build.0 = Release|Any CPU
763+
{D6F5850C-F40D-2A48-578B-7B3F15C31F71}.Release|ARM.ActiveCfg = Release|Any CPU
764+
{D6F5850C-F40D-2A48-578B-7B3F15C31F71}.Release|ARM.Build.0 = Release|Any CPU
765+
{D6F5850C-F40D-2A48-578B-7B3F15C31F71}.Release|x64.ActiveCfg = Release|Any CPU
766+
{D6F5850C-F40D-2A48-578B-7B3F15C31F71}.Release|x64.Build.0 = Release|Any CPU
767+
{D6F5850C-F40D-2A48-578B-7B3F15C31F71}.Release|x86.ActiveCfg = Release|Any CPU
768+
{D6F5850C-F40D-2A48-578B-7B3F15C31F71}.Release|x86.Build.0 = Release|Any CPU
743769
EndGlobalSection
744770
GlobalSection(SolutionProperties) = preSolution
745771
HideSolutionNode = FALSE
@@ -785,6 +811,8 @@ Global
785811
{8ADDBFF3-FCCB-4E16-939F-10E96ECE0C24} = {0BE21A11-8EF0-404B-AFC0-533A62386C4C}
786812
{6924F4DD-E516-33CB-1443-0640759F3C73} = {2F7F283D-5576-417F-A467-EC210226AC3B}
787813
{6700F0EC-ABC9-6321-9501-6F87C2B62AAD} = {0BE21A11-8EF0-404B-AFC0-533A62386C4C}
814+
{D6F5850C-F40D-2A48-578B-7B3F15C31F71} = {0BE21A11-8EF0-404B-AFC0-533A62386C4C}
815+
{2A7B6550-F4EA-4ACE-B659-F262C2FF860E} = {9FC09568-C879-47D8-9D28-E736B8A84C95}
788816
EndGlobalSection
789817
GlobalSection(ExtensibilityGlobals) = postSolution
790818
SolutionGuid = {8F6283C5-9029-434E-BD90-E95FB377DA9B}

src/LinqKit.Core/ExpressionStarter.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,7 @@ public static implicit operator ExpressionStarter<T>(Expression<Func<T, bool>> r
165165
public bool TailCall => Predicate.TailCall;
166166
#endif
167167

168-
#if !(NET35 || WINDOWS_APP || NETSTANDARD || PORTABLE || PORTABLE40 || UAP || EFCORE6 || EFCORE7)
168+
#if !(NET35 || WINDOWS_APP || NETSTANDARD || PORTABLE || PORTABLE40 || UAP || EFCORE6 || EFCORE7 || NET10_0_OR_GREATER)
169169
/// <summary></summary>
170170
[Pure]
171171
public void CompileToMethod(MethodBuilder method) { Predicate.CompileToMethod(method); }

src/LinqKit.Core/Extensions.cs

Lines changed: 1 addition & 225 deletions
Original file line numberDiff line numberDiff line change
@@ -85,228 +85,4 @@ static ExpandableQueryFactory()
8585
}
8686
#endif
8787
}
88-
}
89-
90-
#if NOEF
91-
namespace LinqKit
92-
{
93-
/// <summary>
94-
/// Refer to http://www.albahari.com/nutshell/linqkit.html and http://tomasp.net/blog/linq-expand.aspx for more information.
95-
/// </summary>
96-
public static class ExtensionsCore
97-
{
98-
/// <summary> LinqKit: Expands expression </summary>
99-
[Pure]
100-
public static Expression<TDelegate> Expand<TDelegate>(this Expression<TDelegate> expr)
101-
{
102-
return (Expression<TDelegate>)new ExpressionExpander().Visit(expr);
103-
}
104-
105-
/// <summary> LinqKit: Expands expression </summary>
106-
[Pure]
107-
public static Expression Expand<TDelegate>(this ExpressionStarter<TDelegate> expr)
108-
{
109-
return expr != null && (expr.IsStarted || expr.UseDefaultExpression) ? new ExpressionExpander().Visit(expr) : null;
110-
}
111-
112-
/// <summary> LinqKit: Expands expression </summary>
113-
[Pure]
114-
public static Expression Expand(this Expression expr)
115-
{
116-
return new ExpressionExpander().Visit(expr);
117-
}
118-
119-
/// <summary> LinqKit: Compile and invoke </summary>
120-
[Pure]
121-
public static TResult Invoke<TResult>(this Expression<Func<TResult>> expr)
122-
{
123-
return expr.Compile().Invoke();
124-
}
125-
126-
/// <summary> LinqKit: Compile and invoke </summary>
127-
[Pure]
128-
public static TResult Invoke<T1, TResult>(this Expression<Func<T1, TResult>> expr, T1 arg1)
129-
{
130-
return expr.Compile().Invoke(arg1);
131-
}
132-
133-
/// <summary> LinqKit: Compile and invoke </summary>
134-
[Pure]
135-
public static TResult Invoke<T1, T2, TResult>(this Expression<Func<T1, T2, TResult>> expr, T1 arg1, T2 arg2)
136-
{
137-
return expr.Compile().Invoke(arg1, arg2);
138-
}
139-
140-
/// <summary> LinqKit: Compile and invoke </summary>
141-
[Pure]
142-
public static TResult Invoke<T1, T2, T3, TResult>(
143-
this Expression<Func<T1, T2, T3, TResult>> expr, T1 arg1, T2 arg2, T3 arg3)
144-
{
145-
return expr.Compile().Invoke(arg1, arg2, arg3);
146-
}
147-
148-
/// <summary> LinqKit: Compile and invoke </summary>
149-
[Pure]
150-
public static TResult Invoke<T1, T2, T3, T4, TResult>(
151-
this Expression<Func<T1, T2, T3, T4, TResult>> expr, T1 arg1, T2 arg2, T3 arg3, T4 arg4)
152-
{
153-
return expr.Compile().Invoke(arg1, arg2, arg3, arg4);
154-
}
155-
156-
/// <summary>
157-
/// Performs the specified action on each element of the IEnumerable&lt;T&gt;.
158-
/// </summary>
159-
/// <typeparam name="T">The type of the elements of the source.</typeparam>
160-
/// <param name="source">The IEnumerable&lt;T&gt; to perform the action on.</param>
161-
/// <param name="action">The Action&lt;T&gt; delegate to perform on each element of the IEnumerable&lt;T&gt;.</param>
162-
public static void ForEach<T>(this IEnumerable<T> source, Action<T> action)
163-
{
164-
foreach (var element in source)
165-
{
166-
action(element);
167-
}
168-
}
169-
170-
/// <summary>
171-
/// Correlates the elements of two sequences based on matching keys. The default equality comparer is used to compare keys.
172-
/// </summary>
173-
/// <typeparam name="TOuter">The type of the elements of the first sequence.</typeparam>
174-
/// <typeparam name="TInner">The type of the elements of the second sequence.</typeparam>
175-
/// <typeparam name="TKey">The type of the keys returned by the key selector functions.</typeparam>
176-
/// <typeparam name="TResult">The type of the result elements.</typeparam>
177-
/// <param name="outer">The first sequence to join.</param>
178-
/// <param name="inner">The sequence to left join to the first sequence.</param>
179-
/// <param name="outerKeySelector">A function to extract the join key from each element of the first sequence.</param>
180-
/// <param name="innerKeySelector">A function to extract the join key from each element of the second sequence.</param>
181-
/// <param name="resultSelector">A function to create a result element from two matching elements.</param>
182-
/// <returns>An System.Linq.IQueryable&lt;TResult&gt; that has elements of type TResult obtained by performing an inner join on two sequences.</returns>
183-
[Pure]
184-
public static IQueryable<TResult> LeftJoin<TOuter, TInner, TKey, TResult>(this IQueryable<TOuter> outer,
185-
IEnumerable<TInner> inner,
186-
Expression<Func<TOuter, TKey>> outerKeySelector,
187-
Expression<Func<TInner, TKey>> innerKeySelector,
188-
Expression<Func<TOuter, TInner, TResult>> resultSelector)
189-
{
190-
var leftJoinedQueryable = outer
191-
.GroupJoin(inner, outerKeySelector, innerKeySelector, (outerItem, innerItems) => new { Outer = outerItem, IEnumerableInner = innerItems })
192-
.SelectMany(grouping => grouping.IEnumerableInner.DefaultIfEmpty(), (grouping, innerItem) => new { Outer = grouping.Outer, Inner = innerItem });
193-
return ApplyExpandedSelect(leftJoinedQueryable, pair => resultSelector.Invoke(pair.Outer, pair.Inner));
194-
}
195-
196-
[Pure]
197-
private static IQueryable<TResult> ApplyExpandedSelect<TInput, TResult>(IQueryable<TInput> inputs, Expression<Func<TInput, TResult>> selector)
198-
{
199-
return inputs.Select(selector.Expand());
200-
}
201-
202-
#if !(NET35 || NET40)
203-
/// <summary> LinqKit: Compile and invoke </summary>
204-
[Pure]
205-
public static TResult Invoke<T1, T2, T3, T4, T5, TResult>(
206-
this Expression<Func<T1, T2, T3, T4, T5, TResult>> expr, T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5)
207-
{
208-
return expr.Compile().Invoke(arg1, arg2, arg3, arg4, arg5);
209-
}
210-
211-
/// <summary> LinqKit: Compile and invoke </summary>
212-
[Pure]
213-
public static TResult Invoke<T1, T2, T3, T4, T5, T6, TResult>(
214-
this Expression<Func<T1, T2, T3, T4, T5, T6, TResult>> expr, T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5,
215-
T6 arg6)
216-
{
217-
return expr.Compile().Invoke(arg1, arg2, arg3, arg4, arg5, arg6);
218-
}
219-
220-
/// <summary> LinqKit: Compile and invoke </summary>
221-
[Pure]
222-
public static TResult Invoke<T1, T2, T3, T4, T5, T6, T7, TResult>(
223-
this Expression<Func<T1, T2, T3, T4, T5, T6, T7, TResult>> expr, T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5,
224-
T6 arg6, T7 arg7)
225-
{
226-
return expr.Compile().Invoke(arg1, arg2, arg3, arg4, arg5, arg6, arg7);
227-
}
228-
229-
/// <summary> LinqKit: Compile and invoke </summary>
230-
[Pure]
231-
public static TResult Invoke<T1, T2, T3, T4, T5, T6, T7, T8, TResult>(
232-
this Expression<Func<T1, T2, T3, T4, T5, T6, T7, T8, TResult>> expr, T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5,
233-
T6 arg6, T7 arg7, T8 arg8)
234-
{
235-
return expr.Compile().Invoke(arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8);
236-
}
237-
238-
/// <summary> LinqKit: Compile and invoke </summary>
239-
[Pure]
240-
public static TResult Invoke<T1, T2, T3, T4, T5, T6, T7, T8, T9, TResult>(
241-
this Expression<Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, TResult>> expr, T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5,
242-
T6 arg6, T7 arg7, T8 arg8, T9 arg9)
243-
{
244-
return expr.Compile().Invoke(arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9);
245-
}
246-
247-
/// <summary> LinqKit: Compile and invoke </summary>
248-
[Pure]
249-
public static TResult Invoke<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, TResult>(
250-
this Expression<Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, TResult>> expr, T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5,
251-
T6 arg6, T7 arg7, T8 arg8, T9 arg9, T10 arg10)
252-
{
253-
return expr.Compile().Invoke(arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10);
254-
}
255-
256-
/// <summary> LinqKit: Compile and invoke </summary>
257-
[Pure]
258-
public static TResult Invoke<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, TResult>(
259-
this Expression<Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, TResult>> expr, T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5,
260-
T6 arg6, T7 arg7, T8 arg8, T9 arg9, T10 arg10, T11 arg11)
261-
{
262-
return expr.Compile().Invoke(arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11);
263-
}
264-
265-
/// <summary> LinqKit: Compile and invoke </summary>
266-
[Pure]
267-
public static TResult Invoke<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, TResult>(
268-
this Expression<Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, TResult>> expr, T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5,
269-
T6 arg6, T7 arg7, T8 arg8, T9 arg9, T10 arg10, T11 arg11, T12 arg12)
270-
{
271-
return expr.Compile().Invoke(arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12);
272-
}
273-
274-
/// <summary> LinqKit: Compile and invoke </summary>
275-
[Pure]
276-
public static TResult Invoke<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, TResult>(
277-
this Expression<Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, TResult>> expr, T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5,
278-
T6 arg6, T7 arg7, T8 arg8, T9 arg9, T10 arg10, T11 arg11, T12 arg12, T13 arg13)
279-
{
280-
return expr.Compile().Invoke(arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13);
281-
}
282-
283-
/// <summary> LinqKit: Compile and invoke </summary>
284-
[Pure]
285-
public static TResult Invoke<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, TResult>(
286-
this Expression<Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, TResult>> expr, T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5,
287-
T6 arg6, T7 arg7, T8 arg8, T9 arg9, T10 arg10, T11 arg11, T12 arg12, T13 arg13, T14 arg14)
288-
{
289-
return expr.Compile().Invoke(arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13, arg14);
290-
}
291-
292-
/// <summary> LinqKit: Compile and invoke </summary>
293-
[Pure]
294-
public static TResult Invoke<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, TResult>(
295-
this Expression<Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, TResult>> expr, T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5,
296-
T6 arg6, T7 arg7, T8 arg8, T9 arg9, T10 arg10, T11 arg11, T12 arg12, T13 arg13, T14 arg14, T15 arg15)
297-
{
298-
return expr.Compile().Invoke(arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13, arg14, arg15);
299-
}
300-
301-
/// <summary> LinqKit: Compile and invoke </summary>
302-
[Pure]
303-
public static TResult Invoke<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, TResult>(
304-
this Expression<Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, TResult>> expr, T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5,
305-
T6 arg6, T7 arg7, T8 arg8, T9 arg9, T10 arg10, T11 arg11, T12 arg12, T13 arg13, T14 arg14, T15 arg15, T16 arg16)
306-
{
307-
return expr.Compile().Invoke(arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13, arg14, arg15, arg16);
308-
}
309-
#endif
310-
}
311-
}
312-
#endif
88+
}

0 commit comments

Comments
 (0)