-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Filtering Registration on Handlers #956
Comments
In short, no, I don't really want to enable this behavior. I think you should re-examine your strategy for sharing business logic because it's really no different than any other class library. |
My architecture follows the Clean Architecture pattern. As for now we have 7 api services which consume 7 individual UseCase projects. It could make sense to keep it that way in a simple system with no cross cutting concerns. But in a more robust system with a lot of bounded context. I think it makes a lot more sense to keep them in a single project scoped to a folder, Or even multiple business logic projects with a single bounded context project which references most of them. Either way that prevents a rather large amount of projects for the various different bounded context. Not to get too off topic here but various other mediator libraries are implementing a similar feature for this, Although that wont be available for awhile. We also are long time users of this project and would love to see it implemented here as well. I think there are other benefits to the added ability to filter handlers more explicitly but if you choose to not implement or accept such a PR i respect that as well. Looking deeper into your code, it seems there is a TypeEvaluator already implemented. If that works as it sounds like it should, That would already allow us to filter by attributes with a little work. |
I don't really want to enable the funniness that happens in Clean architecture, I am...not a fan of that. It doesn't sound like you have microservices either, because you don't really share business logic like this amongst microservices. But if something's there that you can use, go for it. |
I would like to know if there is anyway to be a little more explicit about what handlers are registered when using
AddMediatr
Just to explain my use case here. I have a microservice api system which shares a business logic layer. I would like for each microservice to be able to selectively register the handlers which are relevant to each project instead of an all or nothing approach. I'm aware you can add them manually but I'd rather avoid that.
If its not possible would a PR be accepted to do such a thing? I would probably expect something like an attribute which could be used to detect them.
The text was updated successfully, but these errors were encountered: