ServiceCollectionServiceExtensions
Extension methods for adding services to an IServiceCollection.
public static IServiceCollection AddScoped(this IServiceCollection services, Type serviceType, Type implementationType)
Adds a scoped service of the type specified in serviceType with an
implementation of the type specified in implementationType to the
specified IServiceCollection.
public static IServiceCollection AddScoped(this IServiceCollection services, Type serviceType, Func<IServiceProvider, object> implementationFactory)
Adds a scoped service of the type specified in serviceType with a
factory specified in implementationFactory to the
specified IServiceCollection.
public static IServiceCollection AddScoped<TService, TImplementation>(this IServiceCollection services) where TImplementation : TService
Adds a scoped service of the type specified in TService with an
implementation type specified in TImplementation to the
specified IServiceCollection.
Adds a scoped service of the type specified in serviceType to the
specified IServiceCollection.
Adds a scoped service of the type specified in TService to the
specified IServiceCollection.
public static IServiceCollection AddScoped<TService>(this IServiceCollection services, Func<IServiceProvider, TService> implementationFactory)
Adds a scoped service of the type specified in TService with a
factory specified in implementationFactory to the
specified IServiceCollection.
public static IServiceCollection AddScoped<TService, TImplementation>(this IServiceCollection services, Func<IServiceProvider, TImplementation> implementationFactory) where TImplementation : TService
Adds a scoped service of the type specified in TService with an
implementation type specified in TImplementation using the
factory specified in implementationFactory to the
specified IServiceCollection.
public static IServiceCollection AddSingleton(this IServiceCollection services, Type serviceType, Type implementationType)
Adds a singleton service of the type specified in serviceType with an
implementation of the type specified in implementationType to the
specified IServiceCollection.
public static IServiceCollection AddSingleton(this IServiceCollection services, Type serviceType, Func<IServiceProvider, object> implementationFactory)
Adds a singleton service of the type specified in serviceType with a
factory specified in implementationFactory to the
specified IServiceCollection.
public static IServiceCollection AddSingleton<TService, TImplementation>(this IServiceCollection services) where TImplementation : TService
Adds a singleton service of the type specified in TService with an
implementation type specified in TImplementation to the
specified IServiceCollection.
Adds a singleton service of the type specified in serviceType to the
specified IServiceCollection.
Adds a singleton service of the type specified in TService to the
specified IServiceCollection.
public static IServiceCollection AddSingleton<TService>(this IServiceCollection services, Func<IServiceProvider, TService> implementationFactory)
Adds a singleton service of the type specified in TService with a
factory specified in implementationFactory to the
specified IServiceCollection.
public static IServiceCollection AddSingleton<TService, TImplementation>(this IServiceCollection services, Func<IServiceProvider, TImplementation> implementationFactory) where TImplementation : TService
Adds a singleton service of the type specified in TService with an
implementation type specified in TImplementation using the
factory specified in implementationFactory to the
specified IServiceCollection.
public static IServiceCollection AddSingleton(this IServiceCollection services, Type serviceType, object implementationInstance)
Adds a singleton service of the type specified in serviceType with an
instance specified in implementationInstance to the
specified IServiceCollection.
public static IServiceCollection AddSingleton<TService>(this IServiceCollection services, TService implementationInstance)
Adds a singleton service of the type specified in TService with an
instance specified in implementationInstance to the
specified IServiceCollection.
public static IServiceCollection AddTransient(this IServiceCollection services, Type serviceType, Type implementationType)
Adds a transient service of the type specified in serviceType with an
implementation of the type specified in implementationType to the
specified IServiceCollection.
public static IServiceCollection AddTransient(this IServiceCollection services, Type serviceType, Func<IServiceProvider, object> implementationFactory)
Adds a transient service of the type specified in serviceType with a
factory specified in implementationFactory to the
specified IServiceCollection.
public static IServiceCollection AddTransient<TService, TImplementation>(this IServiceCollection services) where TImplementation : TService
Adds a transient service of the type specified in TService with an
implementation type specified in TImplementation to the
specified IServiceCollection.
Adds a transient service of the type specified in serviceType to the
specified IServiceCollection.
Adds a transient service of the type specified in TService to the
specified IServiceCollection.
public static IServiceCollection AddTransient<TService>(this IServiceCollection services, Func<IServiceProvider, TService> implementationFactory)
Adds a transient service of the type specified in TService with a
factory specified in implementationFactory to the
specified IServiceCollection.
public static IServiceCollection AddTransient<TService, TImplementation>(this IServiceCollection services, Func<IServiceProvider, TImplementation> implementationFactory) where TImplementation : TService
Adds a transient service of the type specified in TService with an
implementation type specified in TImplementation using the
factory specified in implementationFactory to the
specified IServiceCollection.