Orbitra.Abstractions
1.0.1
dotnet add package Orbitra.Abstractions --version 1.0.1
NuGet\Install-Package Orbitra.Abstractions -Version 1.0.1
<PackageReference Include="Orbitra.Abstractions" Version="1.0.1" />
<PackageVersion Include="Orbitra.Abstractions" Version="1.0.1" />
<PackageReference Include="Orbitra.Abstractions" />
paket add Orbitra.Abstractions --version 1.0.1
#r "nuget: Orbitra.Abstractions, 1.0.1"
#:package Orbitra.Abstractions@1.0.1
#addin nuget:?package=Orbitra.Abstractions&version=1.0.1
#tool nuget:?package=Orbitra.Abstractions&version=1.0.1
Orbitra.Abstractions
Orbitra.Abstractions contains the core building blocks for working with the Orbitra dispatcher.
It provides lightweight interfaces to define your requests, handlers, and pipeline behaviours, without bringing in any dependencies like Microsoft.Extensions.DependencyInjection.
This package is perfect for:
- Shared contracts across projects (e.g., in a domain or application layer)
- Unit testing without requiring the full Orbitra runtime
- Keeping dependencies minimal in class libraries
Orbitra.Abstractions by itself does not contain the dispatcher implementation or source generation, just the abstraction.
Use the main Orbitra package together with this one when you need dispatching and pipeline execution.
Install
dotnet add package Orbitra.Abstractions
Core Concepts
Requests
A request represents an operation that your system can perform.
Orbitra supports three styles of requests:
| Interface | Purpose |
|---|---|
IRequest<TResult> |
Base request type. Neutral, no category. |
ICommand<TResult> |
Marker interface for commands (mutations, side effects). |
IQuery<TResult> |
Marker interface for queries (read-only operations). |
Example:
using Orbitra.Abstractions.Requests;
// Neutral request
public sealed record PingRequest(string Message) : IRequest<string>;
// Command
public sealed record CreateUserCommand(string UserName) : ICommand<string>;
// Query
public sealed record GetUserQuery(int Id) : IQuery<UserDto>;
public sealed record UserDto(int Id, string Name);
Handlers
A handler processes a request and returns a result.
Each handler implements either the generic IRequestHandler<TRequest, TResult>,
or the more specific ICommandHandler<,> or IQueryHandler<,>.
using Orbitra.Abstractions;
// Neutral handler
public sealed class PingRequestHandler : IRequestHandler<PingRequest, string>
{
public Task<string> HandleAsync(PingRequest request, CancellationToken token = default)
=> Task.FromResult($"PONG: {request.Message}");
}
// Command handler
public sealed class CreateUserCommandHandler : ICommandHandler<CreateUserCommand, string>
{
public Task<string> HandleAsync(CreateUserCommand command, CancellationToken token = default)
=> Task.FromResult($"User {command.UserName} created!");
}
// Query handler
public sealed class GetUserQueryHandler : IQueryHandler<GetUserQuery, UserDto>
{
public Task<UserDto> HandleAsync(GetUserQuery query, CancellationToken token = default)
=> Task.FromResult(new UserDto(query.Id, "Alice"));
}
Pipeline Behaviours
Pipeline behaviours let you define cross-cutting concerns such as logging, validation, or metrics.
They implement IPipelineBehaviour<TRequest, TResult> and wrap around the handler invocation.
using Orbitra.Abstractions.Pipelines;
using Orbitra.Abstractions.Requests;
public sealed class LoggingBehaviour<TRequest, TResult> : IPipelineBehaviour<TRequest, TResult>
where TRequest : IRequest<TResult>
{
public async Task<TResult> HandleAsync(
TRequest request,
DispatchHandlerDelegate<TResult> next,
CancellationToken token = default)
{
Console.WriteLine($"Handling {typeof(TRequest).Name}");
var result = await next();
Console.WriteLine($"Handled {typeof(TRequest).Name}");
return result;
}
}
When to Use Orbitra.Abstractions Alone
You might only need Orbitra.Abstractions when:
- Defining shared contracts in a clean architecture setup.
- Example:
MyApp.Contractsproject references only abstractions, no runtime dependencies.
- Example:
- Writing unit tests for handlers without setting up the full dispatcher or DI.
- Keeping libraries lightweight and dependency-free, while still being compatible with Orbitra.
Related Packages
| Package | Description |
|---|---|
| Orbitra | The runtime dispatcher and pipeline engine. Required for actual dispatching and pipeline execution. |
| Orbitra.DependencyInjection.Microsoft | Extensions for Microsoft.Extensions.DependencyInjection for seamless registration. |
TL;DR
Orbitra.Abstractions= contracts and interfaces only.- Use it to define requests, handlers, and pipelines without runtime dependencies.
- Combine with
Orbitraand optionallyOrbitra.DependencyInjection.Microsoftwhen you need full functionality.
| 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 Orbitra.Abstractions:
| Package | Downloads |
|---|---|
|
Orbitra
Source-generated dispatcher with flexible pipelines. |
GitHub repositories
This package is not used by any popular GitHub repositories.