-
-
Notifications
You must be signed in to change notification settings - Fork 157
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'openapi' into 1367-include-http-headers
- Loading branch information
Showing
13 changed files
with
54 additions
and
47 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
using System.Linq.Expressions; | ||
using System.Reflection; | ||
|
||
#pragma warning disable AV1008 | ||
|
||
namespace JsonApiDotNetCore.Queries; | ||
|
||
internal static class SystemExpressionBuilder | ||
{ | ||
private static readonly MethodInfo CloseOverOpenMethod = | ||
typeof(SystemExpressionBuilder).GetMethods().Single(method => method is { Name: nameof(CloseOver), IsGenericMethod: true }); | ||
|
||
// To enable efficient query plan caching, inline constants (that vary per request) should be converted into query parameters. | ||
// https://stackoverflow.com/questions/54075758/building-a-parameterized-entityframework-core-expression | ||
// | ||
// CloseOver can be used to change a query like: | ||
// SELECT ... FROM ... WHERE x."Age" = 3 | ||
// into: | ||
// SELECT ... FROM ... WHERE x."Age" = @p0 | ||
|
||
public static Expression CloseOver(object value) | ||
{ | ||
ArgumentGuard.NotNull(value); | ||
|
||
MethodInfo closeOverClosedMethod = CloseOverOpenMethod.MakeGenericMethod(value.GetType()); | ||
return (Expression)closeOverClosedMethod.Invoke(null, [value])!; | ||
} | ||
|
||
public static Expression CloseOver<T>(T value) | ||
{ | ||
// From https://github.com/dotnet/efcore/issues/28151#issuecomment-1374480257. | ||
return ((Expression<Func<T>>)(() => value)).Body; | ||
} | ||
} |
33 changes: 0 additions & 33 deletions
33
src/JsonApiDotNetCore/Queries/SystemExpressionExtensions.cs
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.