You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Thank you for catching this one. In general I try to use TryAddSingleton in the source code - inconsistency is by mistake. TryAddSingleton appends the registration to the collection only when there is no registration for the given service type yet in the DI container.
Hi Daniel,
I'm back for another question, in the article https://daniel-krzyczkowski.github.io/Cars-Island-ASP-NET-Core-API-Integration-With-Azure-Cosmos-DB/ you use
TryAddSingleton
to inject the dataservices.In the next article : https://daniel-krzyczkowski.github.io/Cars-Island-ASP-NET-Core-API-Integration-With-Azure-Storage-Accont/ you are in the same case and you mention the AddSingleton
I have used services.AddSingleton with implementationFactory instead of just using services.AddSingleton.
Why not using the
TryAddSingleton
in both? is it a typo or a specific needs for storage service?Thanks!
The text was updated successfully, but these errors were encountered: