コード例 #1
0
        internal static void AddInternalServiceDefintions(this IServiceDefintions services)
        {
            if (!services.Contains <IServiceProvider>())
            {
                services.AddScoped(i => i);
            }

            if (!services.Contains <IServiceScopeFactory>())
            {
                services.AddScoped <IServiceScopeFactory>(i => new ServiceScopeFactory(i));
            }

            if (!services.Contains <IDelegateServiceDefintionHandler, PropertyInjector>())
            {
                services.AddScoped <IDelegateServiceDefintionHandler, PropertyInjector>(i => new PropertyInjector());
            }
        }
コード例 #2
0
 public static IServiceDefintions AddScoped <TService>(this IServiceDefintions services, Func <INamedServiceProvider, TService> implementationFactory, string name = null)
     where TService : class
 {
     return(services.AddScoped(typeof(TService), typeof(TService), implementationFactory, name));
 }
コード例 #3
0
 public static IServiceDefintions AddScoped <TService>(this IServiceDefintions services, string name = null)
     where TService : class
 {
     return(services.AddScoped(typeof(TService), typeof(TService), null, name));
 }
コード例 #4
0
 public static IServiceDefintions AddScoped <TService, TImplementation>(this IServiceDefintions services, string name = null)
     where TService : class where TImplementation : TService
 {
     return(services.AddScoped(typeof(TService), typeof(TImplementation), null, name));
 }
コード例 #5
0
 public static IServiceDefintions AddScoped(this IServiceDefintions services, Type serviceType, Func <INamedServiceProvider, object> serviceFactory, string name = null)
 {
     return(services.AddScoped(serviceType, serviceType, serviceFactory, name));
 }
コード例 #6
0
 public static IServiceDefintions AddScoped(this IServiceDefintions services, Type serviceType, string name = null)
 {
     return(services.AddScoped(serviceType, serviceType, null, name));
 }