Medi8or.Abstractions 2.0.0

dotnet add package Medi8or.Abstractions --version 2.0.0
                    
NuGet\Install-Package Medi8or.Abstractions -Version 2.0.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="Medi8or.Abstractions" Version="2.0.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Medi8or.Abstractions" Version="2.0.0" />
                    
Directory.Packages.props
<PackageReference Include="Medi8or.Abstractions" />
                    
Project file
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 Medi8or.Abstractions --version 2.0.0
                    
#r "nuget: Medi8or.Abstractions, 2.0.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 Medi8or.Abstractions@2.0.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=Medi8or.Abstractions&version=2.0.0
                    
Install as a Cake Addin
#tool nuget:?package=Medi8or.Abstractions&version=2.0.0
                    
Install as a Cake Tool

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 Medi8or or custom implementations.


✨ Features

  • Interfaces for defining commands and queries:
    • IRequest
    • IRequest<TReturn>
  • Interfaces for handlers:
    • IRequestHandler<TRequest>
    • IRequestHandler<TRequest, TReturn>
  • Abstractions for request sending:
    • ISender
    • IMediator

📦 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.


Medi8or – Contains DI extensions and two implementations for sending requests: via reflection (ISender) or via IServiceProvider (IMediator).


🛠️ Requirements

  • .NET 9+
Product 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

    • 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.

Version Downloads Last Updated
2.0.0 198 7/11/2025
1.0.1 209 6/23/2025
1.0.0 214 6/23/2025