martinothamar/Mediator

Multilayered app problem

GunesElektronik opened this issue · 6 comments

I have an application in clean architecture. I wanted to switch from Mediatr to Mediator for performance reasons. But there is a problem here. The problem is that Mediator forces our objects to be in the same project as the Library. Will there be a solution for this?

adrskw commented

You should install Mediator.SourceGenerator in the outermost project and then install Mediator.Abstractions in all remaining projects that define handlers: https://github.com/martinothamar/Mediator#3-usage-and-abstractions

Thanks, I will try it.

it seems that it won't work. on 2.1.7

Hi! Need more specifics to understand what's going wrong. In the meantime, here are some samples showing various ways to organize multiple projects, including clean-architecture style:

Hi. I have the same problem.

I’m trying to publish a notification in my Application.Core Project and catch this notification in my Demo.Server.

Project Overview:

Demo.Server (references Application.Core) with Mediator.Abstractions 2.1.7
Application.Core with Mediator.Abstractions 2.1.7 and Mediator.SourceGenerator 2.1.7 and is adding AddMediator() to a IServiceCollection.

My Application.Core is publishing a notification (for example, DeviceStatusChanged) and also has a consumer for this. My Demo.Server also has a consumer for (DeviceStatusChanged) but never receives this notification."

I hope this helps! If you have any other questions or need further assistance, feel free to ask.

There is an example for multi handler scenarios.

https://github.com/martinothamar/Mediator/blob/d79a4616af843713e0b634f04652a9a42f2063f4/test/Mediator.SourceGenerator.Tests/resources/DuplicateHandlersProgram.cs

Hi. I have the same problem.

I’m trying to publish a notification in my Application.Core Project and catch this notification in my Demo.Server.

Project Overview:

Demo.Server (references Application.Core) with Mediator.Abstractions 2.1.7
Application.Core with Mediator.Abstractions 2.1.7 and Mediator.SourceGenerator 2.1.7 and is adding AddMediator() to a IServiceCollection.

My Application.Core is publishing a notification (for example, DeviceStatusChanged) and also has a consumer for this. My Demo.Server also has a consumer for (DeviceStatusChanged) but never receives this notification."

I hope this helps! If you have any other questions or need further assistance, feel free to ask.

Can you produce a sample project ?