Skip to content
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

Default\Expected behavior when named instance resolution fails or named instance is not found #10

Open
manums opened this issue Dec 4, 2019 · 0 comments

Comments

@manums
Copy link

manums commented Dec 4, 2019

We have a scenario in our project where we Register an interface type with different instances with different name. We also have a register for same interface type without any name.

We need to find out what is the expected behavior When Resolve fails to find any registered instance with given name. Especially in below case where we have another named instanced registered for same interface type IEventPublisher

Documentation for named registrations does not explicitly mention what is the default behavior in such cases.

Example:

container.Register<IEventPublisher>( "ChangeFeed", LifetimeType.Singleton, changeFeedObject);
container.Register<IEventPublisher>( null, LifetimeType.Singleton, changeFeedObject);

// later
var notExistingPublisher = container.Resolve<IEventPublisher>( "nonExistingName" );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant