-
Notifications
You must be signed in to change notification settings - Fork 3.2k
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
React to GetDefaultServices -> AddXXX changes #1129
Conversation
So does this change the behavior for replacing an already added service? In other words, if I first do |
If you use the new extension method (that will go in with this wave of PRs): |
Cool. I'll take care of that. Signing off on this change. |
Merged 88cba14 |
…ent. Issue #956 and also see pull request #1129. This change updates all of our AddXxx methods to use TryAdd when adding to the service collection such that only services that are not already registered will be registered. This also means that the code we had to check the service collection for "hosting" services is no longer needed.
…ent. Issue #956 and also see pull request #1129. This change updates all of our AddXxx methods to use TryAdd when adding to the service collection such that only services that are not already registered will be registered. This also means that the code we had to check the service collection for "hosting" services is no longer needed. Note that services for which it is expected that multiple instances can be registered (e.g. listeners and data sources) must not use TryAdd since otherwise only the first registered will be used.
…ent. Issue #956 and also see pull request #1129. This change updates all of our AddXxx methods to use TryAdd when adding to the service collection such that only services that are not already registered will be registered. This also means that the code we had to check the service collection for "hosting" services is no longer needed. Note that services for which it is expected that multiple instances can be registered (e.g. listeners and data sources) must not use TryAdd since otherwise only the first registered will be used.
EF can probably switch to just adding required services now that AddXXX is safe to call multiple times and no-ops if already there.
Should be able to just AddOptions/AddTypeActivator/AddLogging now. I didn't make this change for EF since it wasn't immediately clear what code could be removed safely