WorkR.Abstractions
0.3.3
dotnet add package WorkR.Abstractions --version 0.3.3
NuGet\Install-Package WorkR.Abstractions -Version 0.3.3
<PackageReference Include="WorkR.Abstractions" Version="0.3.3" />
<PackageVersion Include="WorkR.Abstractions" Version="0.3.3" />
<PackageReference Include="WorkR.Abstractions" />
paket add WorkR.Abstractions --version 0.3.3
#r "nuget: WorkR.Abstractions, 0.3.3"
#:package WorkR.Abstractions@0.3.3
#addin nuget:?package=WorkR.Abstractions&version=0.3.3
#tool nuget:?package=WorkR.Abstractions&version=0.3.3
WorkR.Abstractions
Core interfaces and abstractions for the WorkR background worker framework.
Reference this package from libraries that define reusable workers, triggers, or middleware. It targets netstandard2.0 and has no dependencies.
Installation
dotnet add package WorkR.Abstractions
Interfaces
ITrigger<TContext>
A trigger owns the execution loop and is responsible for calling the downstream worker pipeline. It runs for the lifetime of the host.
public interface ITrigger<out TContext>
where TContext : TriggerContext
{
Task ExecuteAsync(WorkerDelegate<TContext> workerPipeline, CancellationToken stoppingToken);
}
Call workerPipeline to pass a context into the downstream worker chain. Triggers are long-lived singletons; the loop logic (polling, waiting, scheduling) lives entirely within ExecuteAsync.
IWorker<TIn>
The terminal worker in a pipeline. Receives a context value and performs work.
public interface IWorker<in TIn>
{
Task ExecuteAsync(TIn source, CancellationToken cancellationToken);
}
IWorker<TIn, TOut>
A transforming worker. Receives a value, performs optional work, and calls next to pass a new value to the next step in the chain.
public interface IWorker<in TIn, out TOut>
{
Task ExecuteAsync(TIn source, WorkerDelegate<TOut> next, CancellationToken cancellationToken);
}
IWorkerMiddleware
Cross-cutting behaviour that wraps worker execution. Applied per worker step at registration time.
public interface IWorkerMiddleware
{
Task ExecuteAsync(Func<CancellationToken, Task> next, CancellationToken cancellationToken);
}
Context Types
Every trigger produces a TriggerContext. The base class carries metadata about each pipeline invocation:
public abstract class TriggerContext
{
public Guid ExecutionId { get; } // unique per invocation
public DateTimeOffset OccurredAt { get; }
}
WorkR provides three built-in context types:
| Type | Use case |
|---|---|
EmptyTriggerContext |
Time-based triggers with no payload (delay, scheduled, run-once) |
ValueTriggerContext<T> |
Triggers that carry a single typed value |
| Custom subclass | Triggers with multiple fields (e.g. message ID + payload + raw message) |
ValueTriggerContext<T>
public class ValueTriggerContext<T> : TriggerContext
{
public T Value { get; }
}
Implementing a Custom Trigger
public class MyQueueContext : ValueTriggerContext<string>
{
public MyQueueContext(DateTimeOffset occurredAt, string body, string messageId)
: base(occurredAt, body)
{
MessageId = messageId;
}
public string MessageId { get; }
}
public class MyQueueTrigger : ITrigger<MyQueueContext>
{
private readonly IMyQueue _queue;
public MyQueueTrigger(IMyQueue queue) => _queue = queue;
public async Task ExecuteAsync(WorkerDelegate<MyQueueContext> workerPipeline, CancellationToken stoppingToken)
{
while (!stoppingToken.IsCancellationRequested)
{
var message = await _queue.ReceiveAsync(stoppingToken);
await workerPipeline(new MyQueueContext(
DateTimeOffset.UtcNow,
message.Body,
message.MessageId), stoppingToken);
}
}
}
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net5.0 was computed. net5.0-windows was computed. net6.0 was computed. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 was computed. 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. |
| .NET Core | netcoreapp2.0 was computed. netcoreapp2.1 was computed. netcoreapp2.2 was computed. netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
| .NET Standard | netstandard2.0 is compatible. netstandard2.1 was computed. |
| .NET Framework | net461 was computed. net462 was computed. net463 was computed. net47 was computed. net471 was computed. net472 was computed. net48 was computed. net481 was computed. |
| MonoAndroid | monoandroid was computed. |
| MonoMac | monomac was computed. |
| MonoTouch | monotouch was computed. |
| Tizen | tizen40 was computed. tizen60 was computed. |
| Xamarin.iOS | xamarinios was computed. |
| Xamarin.Mac | xamarinmac was computed. |
| Xamarin.TVOS | xamarintvos was computed. |
| Xamarin.WatchOS | xamarinwatchos was computed. |
-
.NETStandard 2.0
- No dependencies.
NuGet packages (1)
Showing the top 1 NuGet packages that depend on WorkR.Abstractions:
| Package | Downloads |
|---|---|
|
WorkR
A lightweight .NET background worker framework built on top of .NET's IHostedService/BackgroundService. Define workers and triggers, compose middleware, and let WorkR manage the execution loop. |
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 0.3.3 | 51 | 5/28/2026 |
| 0.3.2-preview | 51 | 5/28/2026 |
| 0.2.1 | 179 | 5/22/2026 |
| 0.1.7-g2e3259f211 | 167 | 5/19/2026 |
| 0.1.4 | 173 | 5/22/2026 |
| 0.1.2-g00a231d74d | 127 | 5/18/2026 |
| 0.1.1 | 137 | 5/18/2026 |
| 0.0.17-g69ea0bb7c1 | 131 | 5/18/2026 |
| 0.0.6-preview | 51 | 5/28/2026 |
| 0.0.5-preview | 44 | 5/28/2026 |
| 0.0.3-ga2a8ae0176 | 130 | 5/15/2026 |
| 0.0.3-g6695740d51 | 124 | 5/15/2026 |