Skip to content

Commit

Permalink
AsyncQueryExecutorSupplier modiied so it looks-up multiple IAsyncQuer…
Browse files Browse the repository at this point in the history
…yExecutor registrations and returns the first supporting match. (#2730)

Co-authored-by: Vincent Baaij <[email protected]>
  • Loading branch information
miguelhasse and vnbaaij authored Oct 9, 2024
1 parent 41542e2 commit 567215f
Showing 1 changed file with 10 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,9 @@ internal static class AsyncQueryExecutorSupplier
{
if (queryable is not null)
{
var executor = services.GetService<IAsyncQueryExecutor>();
var executors = services.GetServices<IAsyncQueryExecutor>();

if (executor is null)
if (executors is null)
{
// It's useful to detect if the developer is unaware that they should be using the EF adapter, otherwise
// they will likely never notice and simply deploy an inefficient app that blocks threads on each query.
Expand All @@ -37,9 +37,15 @@ internal static class AsyncQueryExecutorSupplier
throw new InvalidOperationException($"The supplied {nameof(IQueryable)} is provided by Entity Framework. To query it efficiently, see https://github.com/microsoft/fluentui-blazor#use-the-datagrid-component-with-ef-core for the needed steps.");
}
}
else if (executor.IsSupported(queryable))
else
{
return executor;
foreach (var executor in executors)
{
if (executor.IsSupported(queryable))
{
return executor;
}
}
}
}

Expand Down

0 comments on commit 567215f

Please sign in to comment.