Biss.Mediator
1.2.0
dotnet add package Biss.Mediator --version 1.2.0
NuGet\Install-Package Biss.Mediator -Version 1.2.0
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="Biss.Mediator" Version="1.2.0" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Biss.Mediator" Version="1.2.0" />
<PackageReference Include="Biss.Mediator" />
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 Biss.Mediator --version 1.2.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: Biss.Mediator, 1.2.0"
#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 Biss.Mediator@1.2.0
#: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=Biss.Mediator&version=1.2.0
#tool nuget:?package=Biss.Mediator&version=1.2.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
Biss.Mediator
Implementação de alta performance do padrão Mediator para .NET 9 usando Source Generators.
📦 Instalação
dotnet add package Biss.Mediator
Funcionalidades
- Sem reflexão no despacho gerado — source generators reduzem o custo em tempo de execução
- Type-safe — erros de encadeamento aparecem em compilação
- Desempenho — caminho otimizado face a mediadores só com reflexão
- Clean Architecture — alinhado com SOLID e handlers explícitos
- AOT / trimming — cenários suportados com limitações documentadas no README da solução
🎯 Uso Rápido
1. Definir Request e Handler
using Biss.Mediator.Abstractions;
// Definir command
public record CreateUserCommand(string Name, string Email) : ICommand<UserId>;
// Criar handler
public class CreateUserHandler : ICommandHandler<CreateUserCommand, UserId>
{
public async Task<Result<UserId>> Handle(
CreateUserCommand request,
CancellationToken cancellationToken)
{
// Sua lógica aqui
var userId = new UserId(Guid.NewGuid());
return Result<UserId>.Success(userId);
}
}
2. Registrar no DI Container
using Biss.Mediator.Extensions.DependencyInjection;
builder.Services.AddMediator(typeof(Program).Assembly);
3. Usar o Mediator
public class UserService
{
private readonly IMediator _mediator;
public UserService(IMediator mediator)
{
_mediator = mediator;
}
public async Task<UserId> CreateUser(string name, string email)
{
var command = new CreateUserCommand(name, email);
var result = await _mediator.Send(command);
if (result.IsSuccess)
return result.Value;
throw new Exception(result.Error.Message);
}
}
📚 Dependências
Este pacote requer:
Biss.Mediator.Abstractions
🔗 Pacotes Relacionados
- Biss.Mediator.Behaviors - Pipeline behaviors pré-implementados
- Biss.Mediator.Extensions.DependencyInjection - Extensões DI
- Biss.Mediator.Extensions.AspNetCore - Integração ASP.NET Core
📄 Licença
MIT License
| 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
- Biss.Mediator.Abstractions (>= 1.2.0)
- Microsoft.Extensions.DependencyInjection.Abstractions (>= 9.0.0)
- Microsoft.Extensions.Logging.Abstractions (>= 9.0.0)
NuGet packages (1)
Showing the top 1 NuGet packages that depend on Biss.Mediator:
| Package | Downloads |
|---|---|
|
Biss.Mediator.Extensions.DependencyInjection
Mediator e Mapper de alta performance para .NET 9 (source generators e reflection). |
GitHub repositories
This package is not used by any popular GitHub repositories.