Medici 1.0.1

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

Medici

Just another simple mediator implementation library.

How to use it?

First you need to install the according packages from NuGet:

  • Medici.Abstractions contains all abstract contracts and interfaces to use in your code
  • Medici contains the implementations for the abstractions above
  • Medici.DependencyInjection contains basic extensions for your IServiceCollection for proper dependency registration
  • Medici.CQRS.Abstractions contains abstract contracts to CQRS and Result patterns
  • Medici.Behaviors.Validation contains simple validation pre-processor realisation
  • Medici.OpenProcessors contains the implementations for open pre/post behavior

Message types

  • IBaseRequest - marker interface for requests
  • IRequest - a request message, no return value (including generic variants)
  • ICommand - a command message with a Result-pattern response
  • IQuery - a query message with a Result-pattern response

Handler types

  • IRequestHandler<in TRequest>
  • IRequestHandler<in TRequest, TResponse>
  • ICommandHandler<in TCommand>
  • ICommandHandler<in TCommand, TResponse>
  • IQueryHandler<in TQuery>
  • IQueryHandler<in TQuery, TResponse>

Pipeline types

  • RequestPreProcessorBehavior<TRequest, TResponse>
  • RequestPostProcessorBehavior<TRequest, TResponse>

Result pattern types

  • Result
  • Result<TValue>

Configuration with IServiceCollection

Medici supports Microsoft.Extensions.DependencyInjection.Abstractions directly. To register various Medici services and handlers:

services.AddMedici(cfg => cfg.RegisterServicesFromAssemblyWithType<Program>());

or with an assembly:

services.AddMedici(cfg => cfg.RegisterServicesFromAssembly(typeof(Program).Assembly));

This registers:

  • IMedici as transient
  • ISender as transient
  • IRequestHandler<,> concrete implementations as transient
  • IRequestHandler<> concrete implementations as transient

To register pre/post processors:

services.AddMedici(cfg => {
    cfg.RegisterServicesFromAssembly(typeof(Program).Assembly);
    cfg.AddRequestPreProcessor<PingPreProcessor>();
    cfg.AddRequestPostProcessor<PingPongPostProcessor>();
    });

or with implementation type

services.AddMedici(cfg => {
    cfg.RegisterServicesFromAssembly(typeof(Program).Assembly);
    cfg.AddRequestPreProcessor<IPingPreProcessor, PingPreProcessor>();
    cfg.AddRequestPostProcessor<IPingPongPostProcessor, PingPongPostProcessor>();
    });

Third-Party Notices

  • This package depends on Scrutor, licensed under the MIT License.
  • This package depends on FluentValidation, licensed under the Apache License 2.0.
Product Compatible and additional computed target framework versions.
.NET 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.

NuGet packages (3)

Showing the top 3 NuGet packages that depend on Medici:

Package Downloads
Medici.DependencyInjection

Simple implementation of mediator pattern in .NET

Medici.Behaviors.Validation

Simple implementation of mediator pattern in .NET

Medici.OpenProcessors

Simple implementation of mediator pattern in .NET

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.0.1 729 12/2/2025
1.0.0 703 12/2/2025