cherry-pick Misc/obsolete redundant extension (#11838)

* Mark AddUnique<TImplementing> obsolete.

* Remove all internal usages of AddUnique<TImplementing>.
This commit is contained in:
Paul Johnson
2022-01-10 16:03:33 +00:00
committed by Paul Johnson
parent 11eaf176a9
commit 8d1fa717ba
8 changed files with 36 additions and 34 deletions

View File

@@ -24,6 +24,8 @@ namespace Umbraco.Extensions
services.AddUnique<TService2>(factory => (TImplementing)factory.GetRequiredService<TService1>());
}
// TODO(V11): Remove this function.
[Obsolete("This method is functionally equivalent to AddSingleton<TImplementing>() please use that instead.")]
public static void AddUnique<TImplementing>(this IServiceCollection services)
where TImplementing : class
=> services.Replace(ServiceDescriptor.Singleton<TImplementing, TImplementing>());