ArturRios.Mediator

CQRS-style command and query dispatch on top of the built-in dependency injection container.

Docs NuGet License: Attribution

A lightweight implementation of the Mediator pattern giving a clean CQRS-style separation between commands (writes) and queries (reads) — with no container of its own.

What you get

  • CommandMediator, QueryMediator, and a combined CommandQueryMediator entry point.
  • Each command or query is dispatched to a dedicated handler resolved from a fresh DI scope, so scoped dependencies such as a DbContext are isolated per execution rather than shared across a request.
  • Synchronous and asynchronous variants for every handler type.
  • Handlers return DataOutput<T> / PaginatedOutput<T> envelopes from ArturRios.Output.
builder.Services.AddSingleton<CommandQueryMediator>();
// then register each handler

Install

dotnet add package ArturRios.Mediator

Family dependencies