Skip to content

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

Open
@manums

Description

@manums

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" );

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions