DomainRelay 3.1.3
dotnet add package DomainRelay --version 3.1.3
NuGet\Install-Package DomainRelay -Version 3.1.3
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="DomainRelay" Version="3.1.3" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="DomainRelay" Version="3.1.3" />
<PackageReference Include="DomainRelay" />
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add DomainRelay --version 3.1.3
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: DomainRelay, 3.1.3"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package DomainRelay@3.1.3
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=DomainRelay&version=3.1.3
#tool nuget:?package=DomainRelay&version=3.1.3
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
DomainRelay
Core mediator implementation for Clean Architecture.
Install
DomainRelay.AbstractionsDomainRelayDomainRelay.DependencyInjection
Optionals:
DomainRelay.DiagnosticsDomainRelay.ValidationDomainRelay.EFCoreDomainRelay.Transport.RabbitMQ
Quick start
Register DomainRelay and scan assemblies containing your handlers:
using DomainRelay.DependencyInjection;
using DomainRelay.Publish;
services.AddDomainRelay(
configureOptions: o =>
{
// Notifications publish strategy (default: SequentialPublishStrategy)
// o.PublishStrategy = new ParallelPublishStrategy();
},
configureRegistration: reg =>
{
reg.Assemblies.Add(typeof(Program).Assembly);
// reg.Assemblies.Add(typeof(SomeHandler).Assembly);
});
Send (Commands / Queries)
using DomainRelay.Abstractions;
public sealed record CreateUser(string Email) : IRequest<Unit>;
public sealed class CreateUserHandler : IRequestHandler<CreateUser, Unit>
{
public Task<Unit> Handle(CreateUser request, CancellationToken ct)
=> Task.FromResult(Unit.Value);
}
await mediator.Send(new CreateUser("a@b.com"), ct);
Publish (Notifications)
using DomainRelay.Abstractions;
public sealed record UserCreated(Guid UserId) : INotification;
public sealed class SendWelcomeEmail : INotificationHandler<UserCreated>
{
public Task Handle(UserCreated notification, CancellationToken ct) => Task.CompletedTask;
}
await mediator.Publish(new UserCreated(userId), ct);
Pipeline behaviors
Behaviors wrap request handlers (validation, transactions, diagnostics, etc.):
using DomainRelay.Abstractions;
public sealed class TimingBehavior<TRequest, TResponse> : IPipelineBehavior<TRequest, TResponse>
where TRequest : IRequest<TResponse>
{
public async Task<TResponse> Handle(TRequest request, CancellationToken ct, HandlerDelegate<TResponse> next)
=> await next();
}
services.AddTransient(typeof(IPipelineBehavior<,>), typeof(TimingBehavior<,>));
Related packages
DomainRelay.DependencyInjectionforAddDomainRelay(...)DomainRelay.DiagnosticsforActivitySourcetracingDomainRelay.Validationfor FluentValidation integrationDomainRelay.EFCorefor transactions + Outbox
| 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. |
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
-
net9.0
- DomainRelay.Abstractions (>= 3.1.3)
NuGet packages (2)
Showing the top 2 NuGet packages that depend on DomainRelay:
| Package | Downloads |
|---|---|
|
DomainRelay.DependencyInjection
Microsoft.Extensions.DependencyInjection integration for DomainRelay. |
|
|
DomainRelay.Diagnostics
Diagnostics (Activity/Tracing) behavior for DomainRelay. |
GitHub repositories
This package is not used by any popular GitHub repositories.