aspnet/EntityFramework — pull request #1182 by ajcvickers (2014-11-27 02:19:56+00:00)
Title: Use TryAdd in AddXxx methods to only add services if not already present.

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.