TaskGate.Core
1.0.3
dotnet add package TaskGate.Core --version 1.0.3
NuGet\Install-Package TaskGate.Core -Version 1.0.3
<PackageReference Include="TaskGate.Core" Version="1.0.3" />
<PackageVersion Include="TaskGate.Core" Version="1.0.3" />
<PackageReference Include="TaskGate.Core" />
paket add TaskGate.Core --version 1.0.3
#r "nuget: TaskGate.Core, 1.0.3"
#:package TaskGate.Core@1.0.3
#addin nuget:?package=TaskGate.Core&version=1.0.3
#tool nuget:?package=TaskGate.Core&version=1.0.3
TaskGate
TaskGate is an execution library designed for high-throughput parallel task processing in .NET. It provides thread-safe DbContext usage, coordinated concurrency limits, and deterministic task execution without requiring any external queueing system.
Highlights
- Configurable parallelism and queue thresholds
- Robust retry and timeout policies
- Extensible provider model for multiple data stores
- Isolated
DbContextmanagement to avoid cross-task interference
Installation
# Core building blocks
dotnet add package TaskGate.Core
# Oracle provider
dotnet add package TaskGate.Oracle
# SQL Server provider
dotnet add package TaskGate.SqlServer
Quick Start
var builder = WebApplication.CreateBuilder(args);
var services = builder.Services;
services.AddOracleTaskGate<MyAppContext>(
connectionString: builder.Configuration.GetConnectionString("TaskGate"),
options =>
{
options.MaxParallelism = 8;
options.MaxQueueSize = 500;
options.TaskTimeout = TimeSpan.FromMinutes(5);
});
var app = builder.Build();
app.Run();
Usage
Simple usage
- Model a work item (
SampleTask) that represents the payload you want to process. - Register TaskGate services in your DI container and inject
ITaskGateRuntime<TContext>where you will orchestrate jobs. - Run a batch by passing tasks and a lightweight handler that receives the scoped
DbContext, any shared HTTP services, and the current task. The following example shows how TaskGate scopes each execution with aDbContextand lets you compose data access alongside custom logic:
internal class ExampleClass
{
private readonly ITaskGateRuntime<SampleDbContext> _taskGate;
public ExampleClass(ITaskGateRuntime<SampleDbContext> taskGate)
{
_taskGate = taskGate;
}
public async Task SampleMethod(CancellationToken ct)
{
var taskList = Enumerable.Range(1, 5)
.Select(x => new SampleTask { Id = x })
.ToList();
await _taskGate.Run(
taskList,
async (db, http, task, token) =>
{
Console.WriteLine($"Task {task.Id} - DbContext Hash: {db.GetHashCode()}");
var companies = await db.Company
.AsNoTracking()
.Take(10)
.ToListAsync(token);
Console.WriteLine($"Task {task.Id} → {companies.Count}");
},
ct
);
}
}
Architecture Snapshot
TaskGate centralizes queueing, leasing, and concurrency coordination in the TaskGate.Core package. Provider packages (Oracle, SQL Server) deliver data-source specific infrastructure while sharing the same leasing and retry primitives. Applications opt into the provider they need and compose TaskGate services through familiar dependency injection patterns.
Provider Layout
- TaskGate.Core – contracts, queue orchestration, concurrency limits, retry policies
- TaskGate.Oracle – Oracle provider implementation and specialized
TaskGateRetryPolicy - TaskGate.SqlServer – SQL Server provider implementation with pooled leasing integration
- Extend the abstractions in
TaskGate.Coreto add your own provider and wire up database operations.
License
MIT
| 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.8)
- Microsoft.Extensions.DependencyInjection.Abstractions (>= 9.0.8)
- Microsoft.Extensions.Http (>= 9.0.8)
NuGet packages (2)
Showing the top 2 NuGet packages that depend on TaskGate.Core:
| Package | Downloads |
|---|---|
|
TaskGate.Oracle
Oracle provider integration for TaskGate parallel execution runtime. |
|
|
TaskGate.SqlServer
SQL Server provider integration for TaskGate parallel execution runtime. |
GitHub repositories
This package is not used by any popular GitHub repositories.