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