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

register multiple services, which are used? #189

Closed
neuecc opened this issue Apr 22, 2021 · 2 comments
Closed

register multiple services, which are used? #189

neuecc opened this issue Apr 22, 2021 · 2 comments

Comments

@neuecc
Copy link

neuecc commented Apr 22, 2021

builder.Register<IFoo, Foo>();
builder.Register<IFoo, Bar>();

builder.Build().Resolver<IFoo>(); // which type?

Is this behavior undefined? First or Last?

Microsoft.Extensions.DependencyInjection uses Last registered.
This is useful for overriding arbitrarily after a plugin has registered.

@hadashiA
Copy link
Owner

hadashiA commented Apr 22, 2021

In the current implementation, First is always returned.
( But I didn't think too much about this behaviour

This is useful for overriding arbitrarily after a plugin has registered.

I see. That looks better.
I'm going to fix it so that Last is returned.

@hadashiA
Copy link
Owner

Released in v1.7.2 .
Thanks for the advice .

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

2 participants