mediatr Questions

3

Does anyone know how to implement MediatR in a console application, to call a handler function using the _mediatr.Send(obj) syntax. I'm using the .Net 6 framework. Thanks for the help.
Microfilm asked 25/7, 2022 at 6:21

6

Solved

In .NET Core, we can add it in ConfigureServices method services.AddMediatR(typeof(Startup)); But in .NET 6, there is only Program.cs. How to add mediatr in .NET 6? Tried with this code but got bu...
Pedagogics asked 16/5, 2022 at 15:35

3

Solved

I'm currently refactoring a bloated MVC .NET Core app to a more simpler .NET Core app using Razor Pages and Mediatr. In the MVC approach there's a BaseController that all controllers inherits from...
Decolonize asked 20/2, 2019 at 10:16

2

I'm trying to hook up MediatR in a client-side Blazor application purely to handle event notifications between components. The event is published, and it gets picked up by a separate component with...

5

Solved

I'm creating an Api and I am also using mediatR, I have created my commands, queries, handlers, but when I try to launch my Api I get this error message in my program class: Could not load type 'Me...
Philbin asked 22/2, 2023 at 1:43

2

Frustrating error I have never seen before and cannot shake it. Using simple Azure HTTP Function in .NET 6 and MediatR 12 and getting the following in Startup.cs for DI of MediatR: System.MissingM...
Embus asked 17/1 at 21:2

3

Solved

I have a MediatR Pipeline behavior for validating commands with the FluentValidation library. I've seen many examples where you throw a ValidationException from the behavior, and that works fine fo...
Jasun asked 9/1, 2019 at 6:8

2

Or is that considered bad practice or something? I have one notification triggers 4-5 handlers, which in turn call database to retrieve data. Each those calls can also be called separately,...
Twitter asked 1/3, 2018 at 3:23

4

[![enter image description here][1]][1]Im using asp.net core .net 6 and MediatR 12.0.1 and i'm not using on purpose MediatR.Extensions.Microsoft.DependencyInjection which is deprecated. In my Progr...
Calipash asked 26/3, 2023 at 13:58

3

Solved

I would like to try the new pipeline feature in MediatR: https://github.com/jbogard/MediatR/wiki/Behaviors I tried the following, but it does not get executed services.AddMediatR(); services.Ad...
Gotten asked 17/2, 2017 at 19:59

4

I am using the Mediatr in my .Net Core project and I was wondering if the handler's in the Mediatr are singleton's or are the new instances for every Send request; I know the Mediatr is a Singleton...
Gosse asked 24/2, 2020 at 22:17

3

Solved

I try to make .NET Core API with CQRS, but i cannot build it because of MediatR error: System.AggregateException: 'Some services are not able to be constructed (Error while validating the service ...
Pontonier asked 1/5, 2020 at 13:41

2

Solved

I have used PUT/POST to update the applications I'm working with, which has been straightforward until now. Now I'm working on an API that should expose a way to update data in a database, and my i...
Spectatress asked 18/6, 2021 at 21:31

17

Solved

I have a .NET Core app where I use the .AddMediatR extension to register the assembly for my commands and handlers following a CQRS approach. In ConfigureServices in Startup.cs i have used the exte...
Euphemiah asked 9/6, 2018 at 12:0

3

Solved

Do you think it might be reasonable to replace my service layer or service classes with MediatR? For example, my service classes look like this: public interface IEntityService<TEntityDto> w...
Dishrag asked 13/6, 2018 at 10:29

6

I am working on a ASP.NET Core 2.2 Web API application with Mediatr. I have a handler that looks like - public class MyQueryHandler<T> : IRequestHanlder<MyQuery<T>, IQueryable<...
Audiometer asked 15/8, 2019 at 2:57

2

I created a request exception handler with known types as below and the exception is handled. The only examples I found are doing it this way. using MediatR.Pipeline; using Microsoft.Extensions.Log...
Midian asked 10/10, 2020 at 19:58

2

Solved

I have tried the CQRS pattern using MediatR and am loving the clean state in which applications am working on are transforming. In all the examples i have seen and used, I always do await Mediator....
Midland asked 31/7, 2020 at 6:12

1

Solved

I want to add MediatR to my services. Here is the code: public class Program { public static async Task Main(string[] args) { var builder = WebApplication.CreateBuilder(args); builder.Services....
Pekoe asked 4/3, 2023 at 13:35

2

Solved

I use a MediatR library in my Asp .Net core 6 app. And I have a the same logic for a group of requests, so I want to use the same handler for all of them. The problem is not new, but the solutions ...
Shaquitashara asked 18/9, 2022 at 7:27

6

Solved

I'm playing around with the new ASP.NET Core and are currently creating a API that I want to call from a JavaScript frontend. I want to use the mediator pattern to reduce the coupling, and I have ...
Whomsoever asked 15/2, 2016 at 12:55

3

I am using MediatR and CQRS in a real project using the Clean Architecture principles. Is it correct to: Call Command from NotificationHandler? Call Command in Command? Call Query in Command? ...
Neuroglia asked 19/9, 2022 at 4:38

2

I'm new to MediatR, trying to make request validation using pipeline behavior, all the examples that I came across were throwing ValidationException if any errors happening. below code is an exampl...
Wendolynwendt asked 21/6, 2021 at 17:59

1

I am using GraphQL as a part of my CQRS application. I have separated Command and Query domain model into two different projects (Query and Command). each of there projects has some models for inst...
Xylol asked 18/3, 2021 at 15:40

2

Solved

I'm using MediatR to do Request - Response logging in my application using IPipelineBehavior<TRequest, TResponse> Code Sample: internal sealed class AppLoggingBehavior<TRequest, TResponse&...
Willing asked 10/1, 2022 at 14:53

© 2022 - 2024 — McMap. All rights reserved.