Medi8or.Abstractions
2.0.0
dotnet add package Medi8or.Abstractions --version 2.0.0
NuGet\Install-Package Medi8or.Abstractions -Version 2.0.0
<PackageReference Include="Medi8or.Abstractions" Version="2.0.0" />
<PackageVersion Include="Medi8or.Abstractions" Version="2.0.0" />
<PackageReference Include="Medi8or.Abstractions" />
paket add Medi8or.Abstractions --version 2.0.0
#r "nuget: Medi8or.Abstractions, 2.0.0"
#:package Medi8or.Abstractions@2.0.0
#addin nuget:?package=Medi8or.Abstractions&version=2.0.0
#tool nuget:?package=Medi8or.Abstractions&version=2.0.0
Medi8or.Abstraction
Medi8or.Abstraction is a lightweight .NET package that defines core interfaces for implementing the Mediator pattern. It provides the foundational abstractions for defining requests (commands/queries), their handlers, and the contracts to send requests — without depending on any specific implementation or reflection logic.
This package is meant to be used together with
Medi8oror custom implementations.
✨ Features
- Interfaces for defining commands and queries:
IRequestIRequest<TReturn>
- Interfaces for handlers:
IRequestHandler<TRequest>IRequestHandler<TRequest, TReturn>
- Abstractions for request sending:
ISenderIMediator
📦 Installation
dotnet add package Medi8or.Abstraction
🧩 Architecture
+------------------------+
| Medi8or.Abstraction |
+------------------------+
| IRequest |
| IRequest<T> |
| IRequestHandler<> |
| ISender, IMediator |
+------------------------+
▲
│
│
+--------------------+
| Medi8or.Core |
| (Implementation) |
+--------------------+
🔌 Usage
Define a query and handler
public class GetUserByIdQuery : IRequest<UserDto>
{
public string Id { get; }
public GetUserByIdQuery(string Id)
{
Id = Id;
}
}
public class GetUserByIdHandler : IRequestHandler<GetUserByIdQuery, UserDto>
{
public async Task<UserDto> Handle(GetUserByIdQuery request, CancellationToken cancellationToken)
{
// Logic here
}
}
Send the request using ISender or IMediator
// ISender use reflection
UserDto user = await _sender.SendAsync(new GetUserByIdQuery(id), cancellationToken);
// IMediator use ServiceProvider
UserDto user = await _mediator.SendAsync<GetUserByIdQuery, UserDto>(new(id), cancellationToken);
🔄 Dependencies
This package has no external dependencies. It's designed to be minimal, reusable, and easily integrated into any architecture.
📘 Related Packages
Medi8or – Contains DI extensions and two implementations for sending requests: via reflection (ISender) or via IServiceProvider (IMediator).
🛠️ Requirements
- .NET 9+
| 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
- No dependencies.
NuGet packages (1)
Showing the top 1 NuGet packages that depend on Medi8or.Abstractions:
| Package | Downloads |
|---|---|
|
Medi8or
A basic implementation of the Mediator pattern to simplify communication and manage interactions between objects, promoting a more modular and loosely coupled design. |
GitHub repositories
This package is not used by any popular GitHub repositories.