Пример #1
0
 public static IServiceDefintions AddSingleton(this IServiceDefintions services, Type serviceType, Func <INamedServiceProvider, object> serviceFactory, string name = null)
 {
     return(services.AddSingleton(serviceType, serviceType, serviceFactory, name));
 }
Пример #2
0
 public static IServiceDefintions AddSingleton(this IServiceDefintions services, Type serviceType, string name = null)
 {
     return(services.AddSingleton(serviceType, serviceType, null, name));
 }
Пример #3
0
 public static IServiceDefintions AddSingleton <TService>(this IServiceDefintions services, TService service, string name = null) where TService : class
 {
     return(services.AddSingleton(typeof(TService), service, name));
 }
Пример #4
0
 public static IServiceDefintions AddSingleton <TService>(this IServiceDefintions services, Func <INamedServiceProvider, TService> serviceFactory, string name = null) where TService : class
 {
     return(services.AddSingleton(typeof(TService), typeof(TService), serviceFactory, name));
 }
Пример #5
0
 public static IServiceDefintions AddSingleton <TService, TImplementation>(this IServiceDefintions services,
                                                                           Func <INamedServiceProvider, TImplementation> serviceFactory, string name = null) where TService : class where TImplementation : TService
 {
     return(services.AddSingleton(typeof(TService), typeof(TImplementation), i => serviceFactory(i), name));
 }
Пример #6
0
 public static IServiceDefintions AddSingleton <TService, TImplementation>(this IServiceDefintions services, string name = null)
     where TService : class where TImplementation : TService
 {
     return(services.AddSingleton(typeof(TService), typeof(TImplementation), null, name));
 }