EntityFrameworkCore.Parallel
6.0.0
dotnet add package EntityFrameworkCore.Parallel --version 6.0.0
NuGet\Install-Package EntityFrameworkCore.Parallel -Version 6.0.0
<PackageReference Include="EntityFrameworkCore.Parallel" Version="6.0.0" />
<PackageVersion Include="EntityFrameworkCore.Parallel" Version="6.0.0" />
<PackageReference Include="EntityFrameworkCore.Parallel" />
paket add EntityFrameworkCore.Parallel --version 6.0.0
#r "nuget: EntityFrameworkCore.Parallel, 6.0.0"
#:package EntityFrameworkCore.Parallel@6.0.0
#addin nuget:?package=EntityFrameworkCore.Parallel&version=6.0.0
#tool nuget:?package=EntityFrameworkCore.Parallel&version=6.0.0
EntityFrameworkCore.Parallel
This extension to Entity Framework Core adds a Set<TContext, TEntity>() method to IDbContextFactory<TContext>.
For easy use it also adds a Parallel() method to IDbContextFactory<TContext> and a Set<TEntity>() method to IDbContextFactory<DbContext>.
This allows you to easily execute multiple queries in parallel without the need to write complex code, or a lot of using blocks or statements.
You can stick to all your known methods from IQueryable<TEntity>.
As the context is disposed after your query is executed, all results will obviously not be tracked and disconnected from any DbContext.
How to use
In your Program.cs, add a DbContextFactory. If you want a pooled one, or not is up to you.
builder.Services.AddPooledDbContextFactory<OrderContext>(options => options.UseSqlServer(@"Server=(localdb)\mssqllocaldb;Database=OrderTest"));
In your business class, inject an IDbContextFactory<TContext> and use it like this
var ordersFromDb = await _factory.Parallel().Set<Order>().Where(o => o.Id > 3).ToListAsync(cancellationToken);
Or like this
var ordersFromDb = await _factory.Set<MyContext, Order>().Where(o => o.Id > 3).ToListAsync(cancellationToken);
Migration from Entity Framework Core 5 to 6
Since Entity Framework Core 6, IDbContextFactory<TContext> is no longer covariant (TContext is not marked with the out keyword).
Because of that, the following code does no longer work.
var ordersFromDb = await _factory.Set<Order>().Where(o => o.Id > 3).ToListAsync();
See the How to use section for two possibilities that you can use instead. If you want some background information, have a look at https://github.com/dotnet/efcore/issues/26630
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net10.0 is compatible. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
-
net10.0
- Microsoft.EntityFrameworkCore (>= 10.0.0)
NuGet packages (1)
Showing the top 1 NuGet packages that depend on EntityFrameworkCore.Parallel:
| Package | Downloads |
|---|---|
|
RESTworld.Business
Package Description |
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 6.0.0 | 493 | 11/11/2025 |
| 5.0.4 | 247 | 11/9/2025 |
| 5.0.3 | 492 | 9/16/2025 |
| 5.0.2 | 388 | 6/19/2025 |
| 5.0.1 | 624 | 1/28/2025 |
| 5.0.0 | 450 | 11/19/2024 |
| 4.1.1 | 5,123 | 10/11/2024 |
| 4.1.0 | 3,664 | 9/20/2024 |
| 4.0.5 | 1,067 | 7/10/2024 |
| 4.0.4 | 392 | 6/4/2024 |
| 4.0.3 | 218 | 5/24/2024 |
| 4.0.2 | 866 | 4/19/2024 |
| 4.0.1 | 2,076 | 1/9/2024 |
| 4.0.0 | 796 | 11/14/2023 |
| 3.0.9 | 540 | 10/23/2023 |
| 3.0.8 | 583 | 9/5/2023 |
| 3.0.7 | 593 | 7/17/2023 |
| 3.0.6 | 556 | 6/28/2023 |
| 3.0.5 | 1,176 | 6/14/2023 |
| 3.0.4 | 1,056 | 4/18/2023 |
| 3.0.3 | 939 | 2/22/2023 |
| 3.0.2 | 583 | 2/9/2023 |
| 3.0.1 | 1,126 | 12/21/2022 |
| 3.0.0 | 1,342 | 11/9/2022 |
| 2.2.0 | 3,504 | 10/20/2022 |
| 2.1.0 | 2,479 | 6/28/2022 |
| 2.0.3 | 3,059 | 5/13/2022 |
| 2.0.2 | 4,032 | 3/9/2022 |
| 2.0.1 | 2,561 | 2/22/2022 |
| 2.0.0 | 3,479 | 12/1/2021 |
| 1.0.2 | 1,295 | 11/4/2021 |
| 1.0.1 | 3,318 | 9/7/2021 |
| 1.0.0 | 2,765 | 11/24/2020 |