DispatchCore 1.0.1

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

DispatchCore

NuGet NuGet Downloads

A lightweight mediator implementation for .NET applications.

DispatchCore provides a simple and extensible way to decouple requests from their handlers while supporting CQRS-oriented and Clean Architecture applications.

It integrates seamlessly with the .NET dependency injection system and automatically registers request handlers through assembly scanning.

Features

  • Request/response handling
  • Automatic handler registration
  • Assembly scanning
  • Native .NET dependency injection integration
  • Lightweight and easy to configure
  • Designed for CQRS and Clean Architecture applications

Requirements

  • .NET 8.0 or later

Installation

Install the latest version of DispatchCore using the .NET CLI:

dotnet add package DispatchCore

Or using the Package Manager Console:

Install-Package DispatchCore

Configuration

Create a DependencyInjection class in your Core or Application project.

public static class DependencyInjection
{
    public static IServiceCollection AddApplicationCore(
        this IServiceCollection services)
    {
        var assembly = typeof(DependencyInjection).Assembly;

        services.AddDispatchCore(assembly);

        return services;
    }
}

The assembly containing the DependencyInjection class is automatically scanned to register request handlers.

Then register your application services in Program.cs:

builder.Services.AddApplicationCore();

Requests and Handlers

Define a request:

public class GetUserQuery : IRequest<UserDto>
{
    public int UserId { get; set; }
}

Create the corresponding handler:

public class GetUserQueryHandler
    : IRequestHandler<GetUserQuery, UserDto>
{
    public async Task<UserDto> Handle(
        GetUserQuery request,
        CancellationToken cancellationToken)
    {
        // Application logic

        return new UserDto();
    }
}

Sending Requests

Inject IMediator into your service or controller:

public class UsersController : ControllerBase
{
    private readonly IMediator _mediator;

    public UsersController(IMediator mediator)
    {
        _mediator = mediator;
    }

    [HttpGet("{id}")]
    public async Task<IActionResult> Get(int id)
    {
        var query = new GetUserQuery
        {
            UserId = id
        };

        var result = await _mediator.Send(query);

        return Ok(result);
    }
}

Assembly Scanning

DispatchCore automatically scans the specified assembly and registers the available request handlers.

services.AddDispatchCore(assembly);

This allows handlers to be registered automatically without manually registering each handler in the dependency injection container.

Clean Architecture and CQRS

DispatchCore is designed to work seamlessly with Clean Architecture and CQRS-based applications.

A typical application structure could look like this:

Application
├── Features
│   ├── Users
│   │   ├── GetUserQuery.cs
│   │   └── GetUserQueryHandler.cs
│   └── Orders
│       ├── CreateOrderCommand.cs
│       └── CreateOrderCommandHandler.cs
└── DependencyInjection.cs

Why DispatchCore?

DispatchCore is designed to keep mediator-based architectures simple and lightweight.

It provides the core functionality required to decouple requests from their handlers while keeping the application architecture clean and easy to maintain.

DispatchCore is a suitable choice for applications that need a simple mediator implementation without unnecessary complexity.

License

This project is licensed under the MIT License.

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 was computed.  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.

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
1.0.1 78 7/17/2026
1.0.0 70 7/17/2026