MediatR.Extensions.Microsoft.DependencyInjection
MediatR.Extensions.Microsoft.DependencyInjection copied to clipboard
Manage DI registrations
Hi @jbogard I have a question regarding this library.
Imagine the following scenario:
One assembly with a bunch of services; That assembly (classlib) is referenced by 2 applications; Some services on that assembly should be registered on the DI container of application1 and the other services for application2 (on this I've created an attribute to, with some reflection, identify which services belong to app1 and app2);
When I execute a request on the app1 it complains about not being able to resolve a dependency of a command that belongs to the app2.
(Unable to resolve service for type 'Service' while attempting to activate 'CreateCommand+CreateCommandHandler'.)')
I'm using the extension method that accepts an array of types and passing the types on each application. Here is a quick example of what I'm doing.
Is this a bug or am I missing something here?
Thanks in advance. ;)
Maybe something like this? This seems to work.
But again, I'm not sure if this will bring me some issues in other places that I'm not aware of it now. :)