public static IServiceCollection AddDisposableSingleton <TService>( [NotNull] this IServiceCollection collection, [NotNull] IDisposable instance) { collection.Add(ServiceDescriptor.DisposableSingleton <TService>(instance)); return(collection); }
public static IServiceCollection AddSingleton <TService>( [NotNull] this IServiceCollection collection, [NotNull] object instance) { collection.Add(ServiceDescriptor.Singleton <TService>(instance)); return(collection); }