Skip to content
This repository was archived by the owner on Feb 15, 2023. It is now read-only.

Manage DI registrations #111

Open
famda opened this issue Jan 5, 2022 · 1 comment
Open

Manage DI registrations #111

famda opened this issue Jan 5, 2022 · 1 comment

Comments

@famda
Copy link

famda commented Jan 5, 2022

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.

image

Is this a bug or am I missing something here?

Thanks in advance. ;)

@famda
Copy link
Author

famda commented Jan 5, 2022

Maybe something like this?
This seems to work.

image

But again, I'm not sure if this will bring me some issues in other places that I'm not aware of it now. :)

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant