Skip to content

Support keyed service for variant service provider#606

Open
zhiyuanliang-ms wants to merge 1 commit into
mainfrom
zhiyuanliang/keyed-vsp
Open

Support keyed service for variant service provider#606
zhiyuanliang-ms wants to merge 1 commit into
mainfrom
zhiyuanliang/keyed-vsp

Conversation

@zhiyuanliang-ms
Copy link
Copy Markdown
Member

Why this PR?

#605 #564

VariantServiceProvider<TService> previously took IEnumerable, which forced the DI container to instantiate every registered implementation of TService at construction time — even variants that would never be selected. This PR changes it to take the IServiceProvider directly and, at runtime, checks whether a keyed service can be retrieved; if so, lazy on-demand instantiation is achieved.

Thanks @Stepami for bringing the keyed service implementation to us, and for clarifying and addressing our compatibility concerns.

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

Successfully merging this pull request may close these issues.

1 participant