ChitMeo 1.0.0

The owner has unlisted this package. This could mean that the package is deprecated, has security vulnerabilities or shouldn't be used anymore.
dotnet add package ChitMeo --version 1.0.0
                    
NuGet\Install-Package ChitMeo -Version 1.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="ChitMeo" Version="1.0.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="ChitMeo" Version="1.0.0" />
                    
Directory.Packages.props
<PackageReference Include="ChitMeo" />
                    
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 ChitMeo --version 1.0.0
                    
#r "nuget: ChitMeo, 1.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 ChitMeo@1.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=ChitMeo&version=1.0.0
                    
Install as a Cake Addin
#tool nuget:?package=ChitMeo&version=1.0.0
                    
Install as a Cake Tool

ChitMeoMediator

ChitMeoMediator - Simple mediator for modular .NET applications. ChitMeoMediator is a lightweight mediator implementation for .NET designed to be simple, dependency-free, and easy to extend. It implements the Mediator pattern commonly used in CQRS architectures while keeping the codebase minimal and transparent.

Features

  • Lightweight and dependency-free
  • Automatic handler discovery
  • Seamless integration with Microsoft.Extensions.DependencyInjection
  • Designed for modular monolith architectures
  • Minimal reflection usage
  • Easy to extend with pipelines and behaviors

Installation

Install from NuGet:

dotnet add package ChitMeoMediator

Quick Start

1. Register ChitMeoMediator

builder.Services.AddMediator();

AddMediator() automatically scans assemblies containing .Module. in their name and registers request handlers.


2. Create a Request

public class Ping : IRequest<string>
{
}

3. Create a Handler

public class PingHandler : IRequestHandler<Ping, string>
{
    public Task<string> HandleAsync(Ping request, CancellationToken cancellationToken)
    {
        return Task.FromResult("Pong");
    }
}

4. Send Request

var result = await mediator.SendAsync(new Ping());

Console.WriteLine(result); // Pong

Interfaces

IRequest

Represents a request expecting a response.

public interface IRequest<TResponse>
{
}

IRequestHandler

Handles a specific request.

public interface IRequestHandler<TRequest, TResponse>
{
    Task<TResponse> HandleAsync(TRequest request, CancellationToken cancellationToken);
}

IMediator

Sends requests to their handlers.

public interface IMediator
{
    Task<TResponse> SendAsync<TResponse>(
        IRequest<TResponse> request,
        CancellationToken cancellationToken = default);
}

Assembly Scanning

ChitMeoMediator automatically discovers handlers in assemblies that match:

*.Module.*.dll

Example:

MyApp.Module.Users
MyApp.Module.Orders

This allows a modular monolith architecture where each module contains its own handlers.


Performance

ChitMeoMediator focuses on simplicity while maintaining excellent performance.

Example benchmark:

Method Mean
Direct call ~21 ns
ChitMeoMediator ~135 ns

The overhead is minimal and suitable for most applications.


Roadmap

Possible future features:

  • Pipeline behaviors
  • Notification handlers
  • Source generator optimization
  • Request caching
  • Transaction pipeline

License

MIT

Product Compatible and additional computed target framework versions.
.NET net8.0 is compatible.  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 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 is compatible.  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.
  • net10.0

    • No dependencies.
  • net8.0

    • No dependencies.
  • net9.0

    • No dependencies.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated