EntityFrameworkCore.Parallel
5.0.3
See the version list below for details.
dotnet add package EntityFrameworkCore.Parallel --version 5.0.3
NuGet\Install-Package EntityFrameworkCore.Parallel -Version 5.0.3
<PackageReference Include="EntityFrameworkCore.Parallel" Version="5.0.3" />
<PackageVersion Include="EntityFrameworkCore.Parallel" Version="5.0.3" />
<PackageReference Include="EntityFrameworkCore.Parallel" />
paket add EntityFrameworkCore.Parallel --version 5.0.3
#r "nuget: EntityFrameworkCore.Parallel, 5.0.3"
#:package EntityFrameworkCore.Parallel@5.0.3
#addin nuget:?package=EntityFrameworkCore.Parallel&version=5.0.3
#tool nuget:?package=EntityFrameworkCore.Parallel&version=5.0.3
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 | net9.0 is compatible. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 was computed. 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. |
-
net9.0
- Microsoft.EntityFrameworkCore (>= 9.0.9)
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 | 332 | 11/11/2025 |
| 5.0.4 | 219 | 11/9/2025 |
| 5.0.3 | 463 | 9/16/2025 |
| 5.0.2 | 365 | 6/19/2025 |
| 5.0.1 | 605 | 1/28/2025 |
| 5.0.0 | 435 | 11/19/2024 |
| 4.1.1 | 4,455 | 10/11/2024 |
| 4.1.0 | 3,555 | 9/20/2024 |
| 4.0.5 | 1,040 | 7/10/2024 |
| 4.0.4 | 372 | 6/4/2024 |
| 4.0.3 | 202 | 5/24/2024 |
| 4.0.2 | 817 | 4/19/2024 |
| 4.0.1 | 2,057 | 1/9/2024 |
| 4.0.0 | 783 | 11/14/2023 |
| 3.0.9 | 529 | 10/23/2023 |
| 3.0.8 | 574 | 9/5/2023 |
| 3.0.7 | 581 | 7/17/2023 |
| 3.0.6 | 547 | 6/28/2023 |
| 3.0.5 | 1,158 | 6/14/2023 |
| 3.0.4 | 1,034 | 4/18/2023 |
| 3.0.3 | 919 | 2/22/2023 |
| 3.0.2 | 570 | 2/9/2023 |
| 3.0.1 | 1,106 | 12/21/2022 |
| 3.0.0 | 1,316 | 11/9/2022 |
| 2.2.0 | 3,486 | 10/20/2022 |
| 2.1.0 | 2,459 | 6/28/2022 |
| 2.0.3 | 3,041 | 5/13/2022 |
| 2.0.2 | 4,018 | 3/9/2022 |
| 2.0.1 | 2,536 | 2/22/2022 |
| 2.0.0 | 3,460 | 12/1/2021 |
| 1.0.2 | 1,274 | 11/4/2021 |
| 1.0.1 | 3,297 | 9/7/2021 |
| 1.0.0 | 2,739 | 11/24/2020 |