Created
May 24, 2024 14:35
-
-
Save PascalSenn/e746a5ddf87a8ad559d71bc3048d0f46 to your computer and use it in GitHub Desktop.
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
if (argument.Type is IFilterInputType filterInput && | |
context.Selection.Field.ContextData | |
.TryGetValue(ContextVisitFilterArgumentKey, out var executorObj) && | |
executorObj is VisitFilterArgument executor) | |
{ | |
var inMemory = IsInMemoryQuery<TEntityType>(input); | |
var visitorContext = executor(filter, filterInput, inMemory); | |
// compile expression tree | |
if (visitorContext.TryCreateLambda( | |
out Expression<Func<TEntityType, bool>>? where)) | |
{ | |
input = ApplyToResult(input, where); | |
} | |
else | |
{ | |
if (visitorContext.Errors.Count > 0) | |
{ | |
input = Array.Empty<TEntityType>(); | |
foreach (var error in visitorContext.Errors) | |
{ | |
context.ReportError(error.WithPath(context.Path)); | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment