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
3 answers

DDD, CQRS and Mediatr query filtering

I am working on a project following CQRS and Mediatr pattern. I have an entity set up like this public class Order { public Guid OrderId { get; set; } public Guid CreatedByUserId { get; set; } public Guid? AcceptedByUserId { get;…
0
votes
1 answer

Events Out of Order While Rebuilding Read Side DB

I have an event sourced system that I am now implementing an endpoint for that will rebuild the read side Data Stores from the event store events. However, I am now running into what seems to be concurrency problems with how I am processing the…
Lamar
  • 581
  • 7
  • 22
0
votes
2 answers

Use MediatR and CQRS in a Windows Service application

I've seen the combination of MediatR and CQRS is used mostly in Web projects (Especially in MVC projects). We can call the Send method of MediatR inside a controller action without an issue. var result = await _mediator.Send(command); Is it…
Aki T
  • 612
  • 2
  • 7
  • 17
0
votes
1 answer

C# how to aggregate results from multiple HTTP requests?

I am designing an application written in C# and AspNetCore that requires making multiple HTTP requests to microservices and aggregating the results before returning to the controller. I have looked into MediatR pipelines but seems limited and unfit…
puri
  • 1,829
  • 5
  • 23
  • 42
0
votes
0 answers

Adding generic decorators with Autofac and MediatR

I'm able to get my commands and queries working ok with their respective handlers, but nothing from decorators. I'm using Autofac with MediatR. A complication is that my messages (commands/queries/events) are in a separate project so need to be…
platypusjh
  • 667
  • 1
  • 7
  • 16
0
votes
0 answers

MediatR and SelectList (and other "populate non-Command data")

Using MediatR in ASP.NET Core. I have a Command for editing a user. One of the properties in the Command is based on a SelectList Dropdown that has values pulled from a DB. Just curious, what do people normally do for that? Do you put the…
Rounder
  • 271
  • 1
  • 6
0
votes
1 answer

Mediator pipline behaviors registration

I have a asp.net core web api project with Mediatr 3.0.1 and structureMap.Microsoft.DependencyInjection 1.4.0. I would like to use the pre and post-processing behavior. The IPipelineBehavior works as expected but thoese 2 don't: public class…
Andre
  • 662
  • 1
  • 8
  • 19
0
votes
0 answers

Async API method using AsyncRequestHandler too many threads?

I guess my question boils down to: Given two async methods where one calls the other. Should I await in both of the methods, or just the first? Here's my scenario. I'm writing an ASP NET CORE WEB API using CQRS and MediatR. I have this async API…
Snæbjørn
  • 10,322
  • 14
  • 65
  • 124
0
votes
3 answers

Unable to register IRequestPreProcessors with Mediatr

I want to register the following dummy IRequestPreProcessor (Mediator 3) public class IdentifyUserTypeCommandHandler : IRequestPreProcessor { private readonly IOptions _options; public…
user4478810
0
votes
1 answer

Wiring up validation in MediatR and ASP.NET Core using autofac

I've just started to use MediatR in an asp.net core project and am struggling to wire up validation ... Here's my controller: public class PersonController : Controller { IMediator mediator; public PersonController(IMediator mediator) { …
0
votes
0 answers

Autofac registration issue with MediatR

I am having some issues with MediatR using AutoFac. My registration code is below which I have lifted and slightly modified from GitHub. The class EntityContext is within the main code assembly, and Assembly is set to that assembly: var builder =…
KnowHoper
  • 4,352
  • 3
  • 39
  • 54
0
votes
2 answers

Can't register Mediatr automatically trough structuremap IoC

I have a web application with multilayer architecture and the classes of handlers and queries in the separate layer from a structuremap configuration. I tried to register all handlers and queries dynamically but I couldn't.When I try to run the…
Pavel Kononenko
  • 318
  • 3
  • 15
0
votes
1 answer

Access ControlerBase outside Action (in CQRS handler)

I'm moving my logic from Controller to CQRS Handlers and I'm not sure how to deal with code that calls ControllerBase stuff like: [HttpPut("users/{id}")] public IActionResult Put(UserForm userForm) { var user = Users.Get(email); if (user ==…
SiberianGuy
  • 24,674
  • 56
  • 152
  • 266
0
votes
0 answers

wrap Mediatr Handler creation and invocation in autofac lifetime scope

In my web.api application I use EntityFramework 6 (EF6), MediatR, and Autofac. I want to Create EF6 DbContext with a lifetime matching MediatR RequestHandlers so that I obtain a unit of work per RequestHandler invocation.I've been looking into…
0
votes
1 answer

Resolve IEnumerable with Autofac

I am trying to build a mediator pipeline with Mediatr and Autofac but am struggling to resolve a collection of validators from Autofac. public class MediatorPipeline : IAsyncRequestHandler where TRequest…
1 2 3
33
34