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

Autofac applying generic decorator on closed types unable to get working

Using Autofac 3.5 and MediatR, I am trying to apply a decorator to a closed type that implements a specific interface. I have the following handler type: class ABCQueryHandler: IRequestHandler And I…
Para Jaco
  • 211
  • 2
  • 9
0
votes
2 answers

Correctly set Scope when using WebApi, SimpleInjector and MediatR

Controller public class LocationsController : ApiController { private readonly IMediator _mediator; public LocationsController(IMediator mediator) { _mediator = mediator; } public IEnumerable Get() { …
jameskind
  • 1,097
  • 2
  • 13
  • 28
0
votes
1 answer

Do IAsyncRequests have to be register in DI

Using MediatR, do IAsyncRequest have to be registered in the container. I've got Unity auto registering everything and quite rightly it's complaining that I have multiple bindings against IAsyncRequest. So I figure I have two options, don't…
Callum Linington
  • 14,213
  • 12
  • 75
  • 154
-1
votes
1 answer

System.AggregateException: Some services are not able to be constructed

I'm writing a project on ASP-NET Core using the MediatR 12.0.1 library. I'm new to .net 6 and I'm learn Dependency Injection. Structure using Application; using Application.Common; using Domain; using Domain.Interfaces; using…
-1
votes
1 answer

DbContext scope when calling a handler from another handler

I have a fairly large application where one handler will call another handler. I have read how this is not something we should be doing: Calling one handler from another one, is it good? Dealing with Duplication in MediatR Handlers Can I send…
-1
votes
1 answer

How can I create custom templates folders in C#?

In theses days I trying to use onion architecture with dotnet core and mediatr library. it's very tedious for me writing code for each use case. I have 8 entities and writing a crud for each entity. I have to create 32 use cases. For this reason, i…
-1
votes
1 answer

I am having a problem implementing MediatR in >NET Web API. I have no idea what is happening

I am following a tutorial about MediatR in .NET Web API, and facing this error : System.AggregateException: 'Some services are not able to be constructed (Error while validating the service descriptor 'ServiceType:…
-2
votes
1 answer

Is it possible to configure MediatR not to handle certain IRequest's?

I have a "big" project with lots of commands/requests. Then I have a couple of API projects that expose a section of these commands trough some end points and I'm using mediator to inspect the "big" assembly in order to know hot to deal with…
RagnaRock
  • 2,432
  • 7
  • 34
  • 56
-2
votes
1 answer

MediatR unable to resolve this issue

Project is in .NET 6 WebAPI C# The error says and I can't figure out why System.InvalidOperationException: 'No service for type 'MediatR.IRequestHandler`2[CFR.Server.Application.Reporting.Queries.GetAllReportingQuery,CFR.Blazor.Shared.AllReports]'…
software is fun
  • 7,286
  • 18
  • 71
  • 129
-2
votes
1 answer

How to manage Mock to work as normal IMediator using MSTest

I am using Mock to establish the mediator variable in the controller via the test method. But when the program encounters the mediator variable referring to mock the test case fails and as well no output is returned. await _mediator.Send(new…
Chiraag D
  • 1
  • 1
-2
votes
1 answer

MediatR instanciate command handler

I don't know if anyone as ever had this problem. I'm trying to instance a class and get this error. "Cannot resolve scoped service 'System.IServiceProvider' from root provider." I even download the source code from MediatR to debug and try to…
Ruben Monteiro
  • 315
  • 3
  • 15
-2
votes
2 answers

MediatR Abstract Base Command

I have a scenario, where I would like to Enable/Disable a PurchaseOrderItem So I have written two separate Command and commandHandlers. Ideally I have to create base abstract class and need to move my logic to one place. How I can achieve this?
Velkumar
  • 446
  • 1
  • 8
  • 20
1 2 3
33
34