Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save PascalSenn/e746a5ddf87a8ad559d71bc3048d0f46 to your computer and use it in GitHub Desktop.
Save PascalSenn/e746a5ddf87a8ad559d71bc3048d0f46 to your computer and use it in GitHub Desktop.
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