All Projects → alsami → MediatR.Extensions.Autofac.DependencyInjection

alsami / MediatR.Extensions.Autofac.DependencyInjection

Licence: MIT License
Autofac plug-in for MediatR.

Programming Languages

C#
18002 projects
shell
77523 projects

Projects that are alternatives of or similar to MediatR.Extensions.Autofac.DependencyInjection

Equinoxproject
Full ASP.NET Core 5 application with DDD, CQRS and Event Sourcing concepts
Stars: ✭ 5,120 (+16966.67%)
Mutual labels:  cqrs, mediatr
Distributed-eStore
Ecommerce SPA application with a microservices architecture implemented from scratch. Tech stack - Docker, Consul, Fabio, RabbitMQ, .Net Core, Mediatr, CQRS, React, Redux. .NET Core Microservices template, .NET React Redux, .NET RabbitMQ, .NET Distributed, Docker, .NET Core with Docker.
Stars: ✭ 99 (+230%)
Mutual labels:  cqrs, mediatr
Eventflow
Async/await first CQRS+ES and DDD framework for .NET
Stars: ✭ 1,932 (+6340%)
Mutual labels:  cqrs, nuget
OpenSleigh
OpenSleigh is a Saga management library for .NET Core.
Stars: ✭ 198 (+560%)
Mutual labels:  cqrs, nuget
MediatrTutorial
CQRS implementation in ASP.NET Core using MediatR in .NET 5
Stars: ✭ 88 (+193.33%)
Mutual labels:  cqrs, mediatr
ddd-net-ef-core
Self study: DDD, .net core, entity framework core
Stars: ✭ 41 (+36.67%)
Mutual labels:  cqrs, mediatr
Autofac.Configuration
Configuration support for Autofac IoC
Stars: ✭ 35 (+16.67%)
Mutual labels:  ioc-container, autofac
Goldeneye
The CQRS flavoured framework that will speed up your WebAPI and Microservices development
Stars: ✭ 171 (+470%)
Mutual labels:  cqrs, nuget
CQRSAndMediator-Microservice
A microservice architecture template which implements the CQRS and Mediator patterns
Stars: ✭ 86 (+186.67%)
Mutual labels:  mediatr, mediator-pattern
KickStart
Application initialization helper
Stars: ✭ 42 (+40%)
Mutual labels:  ioc-container, autofac
RCM
RCM is a simple CRM application designed for Auto Parts Store made with ASP.NET Core based on DDD, CQRS and SOLID Principles.
Stars: ✭ 29 (-3.33%)
Mutual labels:  cqrs, mediatr
CleanArchitecture-Template
This is a solution template for Clean Architecture and CQRS implementation with ASP.NET Core.
Stars: ✭ 60 (+100%)
Mutual labels:  cqrs, mediatr
Ecsrx
A reactive take on the ECS pattern for .net game developers
Stars: ✭ 288 (+860%)
Mutual labels:  nuget, ioc-container
eshopzero
.Net Microservice Application
Stars: ✭ 27 (-10%)
Mutual labels:  cqrs, mediatr
Autofac
An addictive .NET IoC container
Stars: ✭ 3,713 (+12276.67%)
Mutual labels:  ioc-container, autofac
CleanArchitecture
Clean Architecture Solution for .NET 5
Stars: ✭ 18 (-40%)
Mutual labels:  cqrs, mediatr
fastapi-pydiator
Python clean architecture and usecase implementation with fastapi and pydiator-core
Stars: ✭ 58 (+93.33%)
Mutual labels:  mediatr, mediator-pattern
fake-survey-generator
A slightly more-than-trivial full-stack application built with DDD & CQRS concepts
Stars: ✭ 49 (+63.33%)
Mutual labels:  cqrs, mediatr
dudulina
CQRS + Event Sourcing library for PHP
Stars: ✭ 53 (+76.67%)
Mutual labels:  cqrs
tsioc
AOP, Ioc container, Boot framework, unit testing framework , activities workflow framework.
Stars: ✭ 15 (-50%)
Mutual labels:  ioc-container

MediatR.Extensions.Autofac.DependencyInjection

Build Application codecov

NuGet Nuget

This is a cross platform library, written in .netstandard 2.0, that serves as an extension for autofac's containerbuilder. It will register all necessary classes and interfaces of Jimmy Bogard's MediatR implementation to the autofac-container so you can use cqrs and the mediator pattern right ahread without worrying about setting up required infrastracture code.

Installation

This package is available via nuget. You can install it using Visual-Studio-Nuget-Browser or by using the dotnet-cli

dotnet add package MediatR.Extensions.Autofac.DependencyInjection

If you want to add a specific version of this package

dotnet add package MediatR.Extensions.Autofac.DependencyInjection --version 1.0.0

For more information please visit the official dotnet-cli documentation.

Usage

After you have successfully installed the package go ahead to your class and use the extension.

public class Pong 
{
    public DateTime ResponseSendAt { get; }
    
    public Pong(responseSendAt)
    {
        this.ResponseSendAt = responseSendAt;
    }
}

public class PingCommand : IRequest<Pong> {} // Command

public class PingCommandHandler : IRequestHandler<PingCommand, Pong>
{
    public async Task Handle(PingCommand request, CancellationToken cancellationToken) 
    {
        return await Task.FromResult(new Pong(DateTime.UtcNow)).ConfigureAwait(false);
    } 
}

public class Program 
{
    public async Task Main(string[] args)
    {
        var builder = new ContainerBuilder();
        // this will add all your Request- and Notificationhandler
        // that are located in the same project as your program-class
        builder.RegisterMediatR(typeof(Program).Assembly);
        
        var container = builder.Build();
        
        var mediator = container.Resolve<IMediator>();
        
        var response = await mediator.Send(new PingCommand());
        
        // more code here
    }
}

For more information about the usage please check out the samples I have provided.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].