-
Notifications
You must be signed in to change notification settings - Fork 71
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support multiple project #94
Comments
I'm not sure what's going on here, could you describe in a little more detail how the project is laid out? In terms of project references and Mediator package references We have a couple of samples where multiple projects are used, such as this one. Maybe that will help in debugging? |
Thank you for a quick response. I have made a solution that is vertically sliced. I have several projects: Company There are more, but I want to keep it simple, Company and User are class libraries. Each project has its own Context. WebAPI are almost empty, besides from DI and other code that is needed. Controllers are in respective class library there they belong. In each class library, I have added mediator and implemented it just as you have in your documentation. But when I run the application, only the first class library called in DI works. If I call Company first, it will work fine, but User will not work ("No handler registered for message type:"). If I have User first in my DI, it will work vine, but Company will not work ("No handler registered for message type:"). I have tried to move DI registration to the WebAPI project, but I will get ambigious reference, as it should. When I register it in each class library, I get the error I mentioned. My guess that it will only allow one registration in DI. |
Yes that sounds right, we can't have several |
tracking some improvements around multiple projects here: #97 |
So there is no way to have commands and queries in different projects registered? I have a situation and project structured as described by @Dotnetstore |
I've tried this but the weird thing is if you isolate the sample projects and add the Mediator references as NuGet packages the problem @Dotnetstore describes is still present. |
You can have commands and queries in different projects, but you can have only one
I'll try to reproduce this with the multi-project samples. |
Mediator seems not supporting multiple projects. I Have several projects - WebAPI, User, Company. I have mediator installed and correct setup in User and Company. Running those, only the first project registered in DI works.
serviceCollection.AddCompanyServices();
serviceCollection.AddUserServices();
= Company works correctly, User gets error "No handler registered for message type:"
serviceCollection.AddUserServices();
serviceCollection.AddCompanyServices();
= User works correctly, Company gets error "No handler registered for message type:"
The text was updated successfully, but these errors were encountered: