Questions tagged [mediatr]

MediatR is a simple, open source mediator implementation in .NET.

MediatR is a simple, open source, mediator implementation in .NET

A low-ambition library trying to solve a simple problem - decoupling the in-proc sending of messages from handling messages. Cross-platform, supporting .NET 4.5, .NET Standard 1.3, and .NET Standard 2.0.

Supports request/response, commands, queries, notifications and events, synchronous and async with intelligent dispatching via C# generic variance.

See https://github.com/jbogard/MediatR/wiki for more details.

507 questions
0
votes
1 answer

How to use IMediator (MediatR) via dependency injection in Umbraco 7 controller with AutoFac?

I have set up dependency injection with Autofac for my umbracp 7.15.3 app based on this example: https://gosudev.com/blog/software-development/umbraco-cms/umbraco-web-api-and-mvc-dependency-injection-with-autofac/ The example works well with the…
nickornotto
  • 1,946
  • 4
  • 36
  • 68
0
votes
1 answer

Unable to resolve IDbContext while activating Service

Working in CQRS with MediatR, in Startup I register the DomainEventDispatcher, the Repos, Query- and Eventhandlers and the Services. The repos work with DbContext and so do my services. Everything CRUD works until I inject my Service in the…
BHANG
  • 354
  • 1
  • 5
  • 16
0
votes
1 answer

MediatR cancel publish subsequent messages

My Mediatr is using the SyncContinueOnException publish strategy, is there any way to run some validation before start the propagation? Example: _mediatr.Publish(new MyNotification()); public class MyValidationHandler : …
Alexandre
  • 7,004
  • 5
  • 54
  • 72
0
votes
1 answer

After clone of ASP.NET Core Web API project on other computer receiving MediatR error

In my computer application works fine, but other computers receiving next error after trying handle any request: Error constructing handler for request of type MediatR.IRequestHandler`2[Application.User.Register+Command,Application.User.User].…
VaShe
  • 1
  • 2
0
votes
1 answer

Getting ControllerBase Operations into Mediatr Commands

I'm abstracting out my API logic in my controllers to Mediatr Commands and Queries. My POST and PUT endpoints get validated via standard .NET Core model binding validation, but the patchdoc for my PATCH endpoint needs to check the model state for…
Paul DeVito
  • 1,542
  • 3
  • 15
  • 38
0
votes
1 answer

Register IPipelineBehavior in ASP.NET Core 3 with autofac

I want to register pipeline behavior in my project and register that by autofac. I implement that by this way : public class CheckUserNameExistValidation : IPipelineBehavior> { …
mr coder
  • 199
  • 2
  • 14
0
votes
1 answer

Understanding Asp.net Core Dependency Injection when registering multiple implementations of Mediatr IPipelineBehavior

I saw the following code using Asp.Net Core 3.1 with Mediatr using IPipelineBehavior. Startup services.AddTransient(typeof(IPipelineBehavior<,>), typeof(RequestPerformanceBehaviour<,>)); services.AddTransient(typeof(IPipelineBehavior<,>),…
mmohammad
  • 2,334
  • 2
  • 14
  • 23
0
votes
2 answers

Notification Handler don't receiving notification after mediator.publish in .NET-Core

I created a notification class called SendMail as follows: public class SendMail : INotification { public string From { get; set; } public string To { get; set; } public string Subject { get; set; } public string…
Isac Moura
  • 5,940
  • 3
  • 13
  • 27
0
votes
1 answer

Sending a post request from postman returns status code 415

I am using MediatR and Entity Framework Core and I have a post controller action [HttpPost] public async Task> RegisterUser(RegisterUserCommand request) { var response = await _mediator.Send(request); if…
Asker
  • 97
  • 1
  • 11
0
votes
0 answers

How to update an object with EFCore retrieved from Mediator

I am using mediator pattern (specifically MediatR) to grab an object (let's call it and Order) that I want to update with EFCore. However, it's like the item (Order) loses its tracking because it isn't updated. I want to do it like so: public class…
thalacker
  • 2,389
  • 3
  • 23
  • 44
0
votes
1 answer

Mediatr implementation in ASP.Net WebApi2

I am trying to implement mediatr pattern in ASP.Net Web Api. Getting the following error: Handler was not found for request of type …
Atish Jadhav
  • 61
  • 1
  • 2
  • 4
0
votes
1 answer

Ajax call, where parameter is IRequest (Mediatr), has null in all properties

Here is my controller... public class AccountController : BaseController { [Route("Account/json_account_log_in")] public async Task json_account_log_in(ValidateUserQuery query) { ValidateUserDto response = await…
MojoDK
  • 4,410
  • 10
  • 42
  • 80
0
votes
1 answer

Mediatr IPipelineBehavior not triggered

I have implemented Mediatr in my .NET framework project and would like to use a IPipelineBehavior. I have implemented and registered the container using the example from the project:…
JMan
  • 2,611
  • 3
  • 30
  • 51
0
votes
1 answer

CQRS - How to handle if a command requires data from db (query)

I am trying to wrap my head around the best way to approach this problem. I am importing a file that contains bunch of users so I created a handler called ImportUsersCommandHandler and my command is ImportUsersCommand that has List as one of…
Zoinky
  • 4,083
  • 11
  • 40
  • 78
0
votes
2 answers

Build/Test verification for missing implementations of query/commands in MediatR

We're using MediatR heavily in our LoB application, where we use the command & query pattern. Often, to continue in development, we make the commands and the queries first, since they are simple POCOs. This sometimes can lead to forgetting to…
Mortana
  • 1,332
  • 3
  • 15
  • 29