Early Preview
This is currently very much a preview. Please feel free to try things out,
but don't be upset if anything is not yet working. Feedback is welcome over on our
GitHub Dicussions page.
class Microsoft.​Extensions.​DependencyInjection.​ServiceCollectionServiceExtensions
Assembly: Microsoft.Extensions.DependencyInjection.Abstractions
Inheritance: object → ServiceCollectionServiceExtensions
Extension methods for adding services to an <see cref="T:Microsoft.Extensions.DependencyInjection.IServiceCollection" /> .
Methods
public static
IServiceCollection
AddKeyedScoped​(IServiceCollection services,
System.​Type serviceType,
object serviceKey)
Adds a scoped service of the type specified in <paramref name="serviceType" /> to the
specified <see cref="T:Microsoft.Extensions.DependencyInjection.IServiceCollection" /> .
Returns A reference to this instance after the operation has completed.
services
The <see cref="T:Microsoft.Extensions.DependencyInjection.IServiceCollection" /> to add the service to.
serviceType
The type of the service to register and the implementation to use.
serviceKey
The <see cref="P:Microsoft.Extensions.DependencyInjection.ServiceDescriptor.ServiceKey" /> of the service.
public static
IServiceCollection
AddKeyedScoped​(IServiceCollection services,
System.​Type serviceType,
object serviceKey,
System.​Func<​System.​IServiceProvider, object, object> implementationFactory)
Adds a scoped service of the type specified in <paramref name="serviceType" /> with a
factory specified in <paramref name="implementationFactory" /> to the
specified <see cref="T:Microsoft.Extensions.DependencyInjection.IServiceCollection" /> .
Returns A reference to this instance after the operation has completed.
services
The <see cref="T:Microsoft.Extensions.DependencyInjection.IServiceCollection" /> to add the service to.
serviceType
The type of the service to register.
serviceKey
The <see cref="P:Microsoft.Extensions.DependencyInjection.ServiceDescriptor.ServiceKey" /> of the service.
implementationFactory
The factory that creates the service.
public static
IServiceCollection
AddKeyedScoped​(IServiceCollection services,
System.​Type serviceType,
object serviceKey,
System.​Type implementationType)
Adds a scoped service of the type specified in <paramref name="serviceType" /> with an
implementation of the type specified in <paramref name="implementationType" /> to the
specified <see cref="T:Microsoft.Extensions.DependencyInjection.IServiceCollection" /> .
Returns A reference to this instance after the operation has completed.
services
The <see cref="T:Microsoft.Extensions.DependencyInjection.IServiceCollection" /> to add the service to.
serviceType
The type of the service to register.
serviceKey
The <see cref="P:Microsoft.Extensions.DependencyInjection.ServiceDescriptor.ServiceKey" /> of the service.
implementationType
The implementation type of the service.
public static
IServiceCollection
AddKeyedScoped​(IServiceCollection services,
object serviceKey)
Adds a scoped service of the type specified in <typeparamref name="TService" /> to the
specified <see cref="T:Microsoft.Extensions.DependencyInjection.IServiceCollection" /> .
Returns A reference to this instance after the operation has completed.
services
The <see cref="T:Microsoft.Extensions.DependencyInjection.IServiceCollection" /> to add the service to.
serviceKey
The <see cref="P:Microsoft.Extensions.DependencyInjection.ServiceDescriptor.ServiceKey" /> of the service.
public static
IServiceCollection
AddKeyedScoped​(IServiceCollection services,
object serviceKey,
System.​Func<​System.​IServiceProvider, object, TService> implementationFactory)
Adds a scoped service of the type specified in <typeparamref name="TService" /> with a
factory specified in <paramref name="implementationFactory" /> to the
specified <see cref="T:Microsoft.Extensions.DependencyInjection.IServiceCollection" /> .
Returns A reference to this instance after the operation has completed.
services
The <see cref="T:Microsoft.Extensions.DependencyInjection.IServiceCollection" /> to add the service to.
serviceKey
The <see cref="P:Microsoft.Extensions.DependencyInjection.ServiceDescriptor.ServiceKey" /> of the service.
implementationFactory
The factory that creates the service.
public static
IServiceCollection
AddKeyedScoped​(IServiceCollection services,
object serviceKey)
Adds a scoped service of the type specified in <typeparamref name="TService" /> with an
implementation type specified in <typeparamref name="TImplementation" /> to the
specified <see cref="T:Microsoft.Extensions.DependencyInjection.IServiceCollection" /> .
Returns A reference to this instance after the operation has completed.
services
The <see cref="T:Microsoft.Extensions.DependencyInjection.IServiceCollection" /> to add the service to.
serviceKey
The <see cref="P:Microsoft.Extensions.DependencyInjection.ServiceDescriptor.ServiceKey" /> of the service.
public static
IServiceCollection
AddKeyedScoped​(IServiceCollection services,
object serviceKey,
System.​Func<​System.​IServiceProvider, object, TImplementation> implementationFactory)
Adds a scoped service of the type specified in <typeparamref name="TService" /> with an
implementation type specified in <typeparamref name="TImplementation" /> using the
factory specified in <paramref name="implementationFactory" /> to the
specified <see cref="T:Microsoft.Extensions.DependencyInjection.IServiceCollection" /> .
Returns A reference to this instance after the operation has completed.
services
The <see cref="T:Microsoft.Extensions.DependencyInjection.IServiceCollection" /> to add the service to.
serviceKey
The <see cref="P:Microsoft.Extensions.DependencyInjection.ServiceDescriptor.ServiceKey" /> of the service.
implementationFactory
The factory that creates the service.
public static
IServiceCollection
AddKeyedSingleton​(IServiceCollection services,
System.​Type serviceType,
object serviceKey)
Adds a singleton service of the type specified in <paramref name="serviceType" /> to the
specified <see cref="T:Microsoft.Extensions.DependencyInjection.IServiceCollection" /> .
Returns A reference to this instance after the operation has completed.
services
The <see cref="T:Microsoft.Extensions.DependencyInjection.IServiceCollection" /> to add the service to.
serviceType
The type of the service to register and the implementation to use.
serviceKey
The <see cref="P:Microsoft.Extensions.DependencyInjection.ServiceDescriptor.ServiceKey" /> of the service.
public static
IServiceCollection
AddKeyedSingleton​(IServiceCollection services,
System.​Type serviceType,
object serviceKey,
System.​Func<​System.​IServiceProvider, object, object> implementationFactory)
Adds a singleton service of the type specified in <paramref name="serviceType" /> with a
factory specified in <paramref name="implementationFactory" /> to the
specified <see cref="T:Microsoft.Extensions.DependencyInjection.IServiceCollection" /> .
Returns A reference to this instance after the operation has completed.
services
The <see cref="T:Microsoft.Extensions.DependencyInjection.IServiceCollection" /> to add the service to.
serviceType
The type of the service to register.
serviceKey
The <see cref="P:Microsoft.Extensions.DependencyInjection.ServiceDescriptor.ServiceKey" /> of the service.
implementationFactory
The factory that creates the service.
public static
IServiceCollection
AddKeyedSingleton​(IServiceCollection services,
System.​Type serviceType,
object serviceKey,
object implementationInstance)
Adds a singleton service of the type specified in <paramref name="serviceType" /> with an
instance specified in <paramref name="implementationInstance" /> to the
specified <see cref="T:Microsoft.Extensions.DependencyInjection.IServiceCollection" /> .
Returns A reference to this instance after the operation has completed.
services
The <see cref="T:Microsoft.Extensions.DependencyInjection.IServiceCollection" /> to add the service to.
serviceType
The type of the service to register.
serviceKey
The <see cref="P:Microsoft.Extensions.DependencyInjection.ServiceDescriptor.ServiceKey" /> of the service.
implementationInstance
The instance of the service.
public static
IServiceCollection
AddKeyedSingleton​(IServiceCollection services,
System.​Type serviceType,
object serviceKey,
System.​Type implementationType)
Adds a singleton service of the type specified in <paramref name="serviceType" /> with an
implementation of the type specified in <paramref name="implementationType" /> to the
specified <see cref="T:Microsoft.Extensions.DependencyInjection.IServiceCollection" /> .
Returns A reference to this instance after the operation has completed.
services
The <see cref="T:Microsoft.Extensions.DependencyInjection.IServiceCollection" /> to add the service to.
serviceType
The type of the service to register.
serviceKey
The <see cref="P:Microsoft.Extensions.DependencyInjection.ServiceDescriptor.ServiceKey" /> of the service.
implementationType
The implementation type of the service.
public static
IServiceCollection
AddKeyedSingleton​(IServiceCollection services,
object serviceKey)
Adds a singleton service of the type specified in <typeparamref name="TService" /> to the
specified <see cref="T:Microsoft.Extensions.DependencyInjection.IServiceCollection" /> .
Returns A reference to this instance after the operation has completed.
services
The <see cref="T:Microsoft.Extensions.DependencyInjection.IServiceCollection" /> to add the service to.
serviceKey
The <see cref="P:Microsoft.Extensions.DependencyInjection.ServiceDescriptor.ServiceKey" /> of the service.
public static
IServiceCollection
AddKeyedSingleton​(IServiceCollection services,
object serviceKey,
System.​Func<​System.​IServiceProvider, object, TService> implementationFactory)
Adds a singleton service of the type specified in <typeparamref name="TService" /> with a
factory specified in <paramref name="implementationFactory" /> to the
specified <see cref="T:Microsoft.Extensions.DependencyInjection.IServiceCollection" /> .
Returns A reference to this instance after the operation has completed.
services
The <see cref="T:Microsoft.Extensions.DependencyInjection.IServiceCollection" /> to add the service to.
serviceKey
The <see cref="P:Microsoft.Extensions.DependencyInjection.ServiceDescriptor.ServiceKey" /> of the service.
implementationFactory
The factory that creates the service.
public static
IServiceCollection
AddKeyedSingleton​(IServiceCollection services,
object serviceKey,
TService implementationInstance)
Adds a singleton service of the type specified in <typeparamref name="TService" /> with an
instance specified in <paramref name="implementationInstance" /> to the
specified <see cref="T:Microsoft.Extensions.DependencyInjection.IServiceCollection" /> .
Returns A reference to this instance after the operation has completed.
services
The <see cref="T:Microsoft.Extensions.DependencyInjection.IServiceCollection" /> to add the service to.
serviceKey
The <see cref="P:Microsoft.Extensions.DependencyInjection.ServiceDescriptor.ServiceKey" /> of the service.
implementationInstance
The instance of the service.
public static
IServiceCollection
AddKeyedSingleton​(IServiceCollection services,
object serviceKey)
Adds a singleton service of the type specified in <typeparamref name="TService" /> with an
implementation type specified in <typeparamref name="TImplementation" /> to the
specified <see cref="T:Microsoft.Extensions.DependencyInjection.IServiceCollection" /> .
Returns A reference to this instance after the operation has completed.
services
The <see cref="T:Microsoft.Extensions.DependencyInjection.IServiceCollection" /> to add the service to.
serviceKey
The <see cref="P:Microsoft.Extensions.DependencyInjection.ServiceDescriptor.ServiceKey" /> of the service.
public static
IServiceCollection
AddKeyedSingleton​(IServiceCollection services,
object serviceKey,
System.​Func<​System.​IServiceProvider, object, TImplementation> implementationFactory)
Adds a singleton service of the type specified in <typeparamref name="TService" /> with an
implementation type specified in <typeparamref name="TImplementation" /> using the
factory specified in <paramref name="implementationFactory" /> to the
specified <see cref="T:Microsoft.Extensions.DependencyInjection.IServiceCollection" /> .
Returns A reference to this instance after the operation has completed.
services
The <see cref="T:Microsoft.Extensions.DependencyInjection.IServiceCollection" /> to add the service to.
serviceKey
The <see cref="P:Microsoft.Extensions.DependencyInjection.ServiceDescriptor.ServiceKey" /> of the service.
implementationFactory
The factory that creates the service.
public static
IServiceCollection
AddKeyedTransient​(IServiceCollection services,
System.​Type serviceType,
object serviceKey)
Adds a transient service of the type specified in <paramref name="serviceType" /> to the
specified <see cref="T:Microsoft.Extensions.DependencyInjection.IServiceCollection" /> .
Returns A reference to this instance after the operation has completed.
services
The <see cref="T:Microsoft.Extensions.DependencyInjection.IServiceCollection" /> to add the service to.
serviceType
The type of the service to register and the implementation to use.
serviceKey
The <see cref="P:Microsoft.Extensions.DependencyInjection.ServiceDescriptor.ServiceKey" /> of the service.
public static
IServiceCollection
AddKeyedTransient​(IServiceCollection services,
System.​Type serviceType,
object serviceKey,
System.​Func<​System.​IServiceProvider, object, object> implementationFactory)
Adds a transient service of the type specified in <paramref name="serviceType" /> with a
factory specified in <paramref name="implementationFactory" /> to the
specified <see cref="T:Microsoft.Extensions.DependencyInjection.IServiceCollection" /> .
Returns A reference to this instance after the operation has completed.
services
The <see cref="T:Microsoft.Extensions.DependencyInjection.IServiceCollection" /> to add the service to.
serviceType
The type of the service to register.
serviceKey
The <see cref="P:Microsoft.Extensions.DependencyInjection.ServiceDescriptor.ServiceKey" /> of the service.
implementationFactory
The factory that creates the service.
public static
IServiceCollection
AddKeyedTransient​(IServiceCollection services,
System.​Type serviceType,
object serviceKey,
System.​Type implementationType)
Adds a transient service of the type specified in <paramref name="serviceType" /> with an
implementation of the type specified in <paramref name="implementationType" /> to the
specified <see cref="T:Microsoft.Extensions.DependencyInjection.IServiceCollection" /> .
Returns A reference to this instance after the operation has completed.
services
The <see cref="T:Microsoft.Extensions.DependencyInjection.IServiceCollection" /> to add the service to.
serviceType
The type of the service to register.
serviceKey
The <see cref="P:Microsoft.Extensions.DependencyInjection.ServiceDescriptor.ServiceKey" /> of the service.
implementationType
The implementation type of the service.
public static
IServiceCollection
AddKeyedTransient​(IServiceCollection services,
object serviceKey)
Adds a transient service of the type specified in <typeparamref name="TService" /> to the
specified <see cref="T:Microsoft.Extensions.DependencyInjection.IServiceCollection" /> .
Returns A reference to this instance after the operation has completed.
services
The <see cref="T:Microsoft.Extensions.DependencyInjection.IServiceCollection" /> to add the service to.
serviceKey
The <see cref="P:Microsoft.Extensions.DependencyInjection.ServiceDescriptor.ServiceKey" /> of the service.
public static
IServiceCollection
AddKeyedTransient​(IServiceCollection services,
object serviceKey,
System.​Func<​System.​IServiceProvider, object, TService> implementationFactory)
Adds a transient service of the type specified in <typeparamref name="TService" /> with a
factory specified in <paramref name="implementationFactory" /> to the
specified <see cref="T:Microsoft.Extensions.DependencyInjection.IServiceCollection" /> .
Returns A reference to this instance after the operation has completed.
services
The <see cref="T:Microsoft.Extensions.DependencyInjection.IServiceCollection" /> to add the service to.
serviceKey
The <see cref="P:Microsoft.Extensions.DependencyInjection.ServiceDescriptor.ServiceKey" /> of the service.
implementationFactory
The factory that creates the service.
public static
IServiceCollection
AddKeyedTransient​(IServiceCollection services,
object serviceKey)
Adds a transient service of the type specified in <typeparamref name="TService" /> with an
implementation type specified in <typeparamref name="TImplementation" /> to the
specified <see cref="T:Microsoft.Extensions.DependencyInjection.IServiceCollection" /> .
Returns A reference to this instance after the operation has completed.
services
The <see cref="T:Microsoft.Extensions.DependencyInjection.IServiceCollection" /> to add the service to.
serviceKey
The <see cref="P:Microsoft.Extensions.DependencyInjection.ServiceDescriptor.ServiceKey" /> of the service.
public static
IServiceCollection
AddKeyedTransient​(IServiceCollection services,
object serviceKey,
System.​Func<​System.​IServiceProvider, object, TImplementation> implementationFactory)
Adds a transient service of the type specified in <typeparamref name="TService" /> with an
implementation type specified in <typeparamref name="TImplementation" /> using the
factory specified in <paramref name="implementationFactory" /> to the
specified <see cref="T:Microsoft.Extensions.DependencyInjection.IServiceCollection" /> .
Returns A reference to this instance after the operation has completed.
services
The <see cref="T:Microsoft.Extensions.DependencyInjection.IServiceCollection" /> to add the service to.
serviceKey
The <see cref="P:Microsoft.Extensions.DependencyInjection.ServiceDescriptor.ServiceKey" /> of the service.
implementationFactory
The factory that creates the service.
public static
IServiceCollection
AddScoped​(IServiceCollection services,
System.​Type serviceType)
Adds a scoped service of the type specified in <paramref name="serviceType" /> to the
specified <see cref="T:Microsoft.Extensions.DependencyInjection.IServiceCollection" /> .
Returns A reference to this instance after the operation has completed.
services
The <see cref="T:Microsoft.Extensions.DependencyInjection.IServiceCollection" /> to add the service to.
serviceType
The type of the service to register and the implementation to use.
public static
IServiceCollection
AddScoped​(IServiceCollection services,
System.​Type serviceType,
System.​Func<​System.​IServiceProvider, object> implementationFactory)
Adds a scoped service of the type specified in <paramref name="serviceType" /> with a
factory specified in <paramref name="implementationFactory" /> to the
specified <see cref="T:Microsoft.Extensions.DependencyInjection.IServiceCollection" /> .
Returns A reference to this instance after the operation has completed.
services
The <see cref="T:Microsoft.Extensions.DependencyInjection.IServiceCollection" /> to add the service to.
serviceType
The type of the service to register.
implementationFactory
The factory that creates the service.
public static
IServiceCollection
AddScoped​(IServiceCollection services,
System.​Type serviceType,
System.​Type implementationType)
Adds a scoped service of the type specified in <paramref name="serviceType" /> with an
implementation of the type specified in <paramref name="implementationType" /> to the
specified <see cref="T:Microsoft.Extensions.DependencyInjection.IServiceCollection" /> .
Returns A reference to this instance after the operation has completed.
services
The <see cref="T:Microsoft.Extensions.DependencyInjection.IServiceCollection" /> to add the service to.
serviceType
The type of the service to register.
implementationType
The implementation type of the service.
public static
IServiceCollection
AddScoped​(IServiceCollection services)
Adds a scoped service of the type specified in <typeparamref name="TService" /> to the
specified <see cref="T:Microsoft.Extensions.DependencyInjection.IServiceCollection" /> .
Returns A reference to this instance after the operation has completed.
services
The <see cref="T:Microsoft.Extensions.DependencyInjection.IServiceCollection" /> to add the service to.
public static
IServiceCollection
AddScoped​(IServiceCollection services,
System.​Func<​System.​IServiceProvider, TService> implementationFactory)
Adds a scoped service of the type specified in <typeparamref name="TService" /> with a
factory specified in <paramref name="implementationFactory" /> to the
specified <see cref="T:Microsoft.Extensions.DependencyInjection.IServiceCollection" /> .
Returns A reference to this instance after the operation has completed.
services
The <see cref="T:Microsoft.Extensions.DependencyInjection.IServiceCollection" /> to add the service to.
implementationFactory
The factory that creates the service.
public static
IServiceCollection
AddScoped​(IServiceCollection services)
Adds a scoped service of the type specified in <typeparamref name="TService" /> with an
implementation type specified in <typeparamref name="TImplementation" /> to the
specified <see cref="T:Microsoft.Extensions.DependencyInjection.IServiceCollection" /> .
Returns A reference to this instance after the operation has completed.
services
The <see cref="T:Microsoft.Extensions.DependencyInjection.IServiceCollection" /> to add the service to.
public static
IServiceCollection
AddScoped​(IServiceCollection services,
System.​Func<​System.​IServiceProvider, TImplementation> implementationFactory)
Adds a scoped service of the type specified in <typeparamref name="TService" /> with an
implementation type specified in <typeparamref name="TImplementation" /> using the
factory specified in <paramref name="implementationFactory" /> to the
specified <see cref="T:Microsoft.Extensions.DependencyInjection.IServiceCollection" /> .
Returns A reference to this instance after the operation has completed.
services
The <see cref="T:Microsoft.Extensions.DependencyInjection.IServiceCollection" /> to add the service to.
implementationFactory
The factory that creates the service.
public static
IServiceCollection
AddSingleton​(IServiceCollection services,
System.​Type serviceType)
Adds a singleton service of the type specified in <paramref name="serviceType" /> to the
specified <see cref="T:Microsoft.Extensions.DependencyInjection.IServiceCollection" /> .
Returns A reference to this instance after the operation has completed.
services
The <see cref="T:Microsoft.Extensions.DependencyInjection.IServiceCollection" /> to add the service to.
serviceType
The type of the service to register and the implementation to use.
public static
IServiceCollection
AddSingleton​(IServiceCollection services,
System.​Type serviceType,
System.​Func<​System.​IServiceProvider, object> implementationFactory)
Adds a singleton service of the type specified in <paramref name="serviceType" /> with a
factory specified in <paramref name="implementationFactory" /> to the
specified <see cref="T:Microsoft.Extensions.DependencyInjection.IServiceCollection" /> .
Returns A reference to this instance after the operation has completed.
services
The <see cref="T:Microsoft.Extensions.DependencyInjection.IServiceCollection" /> to add the service to.
serviceType
The type of the service to register.
implementationFactory
The factory that creates the service.
public static
IServiceCollection
AddSingleton​(IServiceCollection services,
System.​Type serviceType,
object implementationInstance)
Adds a singleton service of the type specified in <paramref name="serviceType" /> with an
instance specified in <paramref name="implementationInstance" /> to the
specified <see cref="T:Microsoft.Extensions.DependencyInjection.IServiceCollection" /> .
Returns A reference to this instance after the operation has completed.
services
The <see cref="T:Microsoft.Extensions.DependencyInjection.IServiceCollection" /> to add the service to.
serviceType
The type of the service to register.
implementationInstance
The instance of the service.
public static
IServiceCollection
AddSingleton​(IServiceCollection services,
System.​Type serviceType,
System.​Type implementationType)
Adds a singleton service of the type specified in <paramref name="serviceType" /> with an
implementation of the type specified in <paramref name="implementationType" /> to the
specified <see cref="T:Microsoft.Extensions.DependencyInjection.IServiceCollection" /> .
Returns A reference to this instance after the operation has completed.
services
The <see cref="T:Microsoft.Extensions.DependencyInjection.IServiceCollection" /> to add the service to.
serviceType
The type of the service to register.
implementationType
The implementation type of the service.
public static
IServiceCollection
AddSingleton​(IServiceCollection services)
Adds a singleton service of the type specified in <typeparamref name="TService" /> to the
specified <see cref="T:Microsoft.Extensions.DependencyInjection.IServiceCollection" /> .
Returns A reference to this instance after the operation has completed.
services
The <see cref="T:Microsoft.Extensions.DependencyInjection.IServiceCollection" /> to add the service to.
public static
IServiceCollection
AddSingleton​(IServiceCollection services,
System.​Func<​System.​IServiceProvider, TService> implementationFactory)
Adds a singleton service of the type specified in <typeparamref name="TService" /> with a
factory specified in <paramref name="implementationFactory" /> to the
specified <see cref="T:Microsoft.Extensions.DependencyInjection.IServiceCollection" /> .
Returns A reference to this instance after the operation has completed.
services
The <see cref="T:Microsoft.Extensions.DependencyInjection.IServiceCollection" /> to add the service to.
implementationFactory
The factory that creates the service.
public static
IServiceCollection
AddSingleton​(IServiceCollection services,
TService implementationInstance)
Adds a singleton service of the type specified in <typeparamref name="TService" /> with an
instance specified in <paramref name="implementationInstance" /> to the
specified <see cref="T:Microsoft.Extensions.DependencyInjection.IServiceCollection" /> .
Returns A reference to this instance after the operation has completed.
services
The <see cref="T:Microsoft.Extensions.DependencyInjection.IServiceCollection" /> to add the service to.
implementationInstance
The instance of the service.
public static
IServiceCollection
AddSingleton​(IServiceCollection services)
Adds a singleton service of the type specified in <typeparamref name="TService" /> with an
implementation type specified in <typeparamref name="TImplementation" /> to the
specified <see cref="T:Microsoft.Extensions.DependencyInjection.IServiceCollection" /> .
Returns A reference to this instance after the operation has completed.
services
The <see cref="T:Microsoft.Extensions.DependencyInjection.IServiceCollection" /> to add the service to.
public static
IServiceCollection
AddSingleton​(IServiceCollection services,
System.​Func<​System.​IServiceProvider, TImplementation> implementationFactory)
Adds a singleton service of the type specified in <typeparamref name="TService" /> with an
implementation type specified in <typeparamref name="TImplementation" /> using the
factory specified in <paramref name="implementationFactory" /> to the
specified <see cref="T:Microsoft.Extensions.DependencyInjection.IServiceCollection" /> .
Returns A reference to this instance after the operation has completed.
services
The <see cref="T:Microsoft.Extensions.DependencyInjection.IServiceCollection" /> to add the service to.
implementationFactory
The factory that creates the service.
public static
IServiceCollection
AddTransient​(IServiceCollection services,
System.​Type serviceType)
Adds a transient service of the type specified in <paramref name="serviceType" /> to the
specified <see cref="T:Microsoft.Extensions.DependencyInjection.IServiceCollection" /> .
Returns A reference to this instance after the operation has completed.
services
The <see cref="T:Microsoft.Extensions.DependencyInjection.IServiceCollection" /> to add the service to.
serviceType
The type of the service to register and the implementation to use.
public static
IServiceCollection
AddTransient​(IServiceCollection services,
System.​Type serviceType,
System.​Func<​System.​IServiceProvider, object> implementationFactory)
Adds a transient service of the type specified in <paramref name="serviceType" /> with a
factory specified in <paramref name="implementationFactory" /> to the
specified <see cref="T:Microsoft.Extensions.DependencyInjection.IServiceCollection" /> .
Returns A reference to this instance after the operation has completed.
services
The <see cref="T:Microsoft.Extensions.DependencyInjection.IServiceCollection" /> to add the service to.
serviceType
The type of the service to register.
implementationFactory
The factory that creates the service.
public static
IServiceCollection
AddTransient​(IServiceCollection services,
System.​Type serviceType,
System.​Type implementationType)
Adds a transient service of the type specified in <paramref name="serviceType" /> with an
implementation of the type specified in <paramref name="implementationType" /> to the
specified <see cref="T:Microsoft.Extensions.DependencyInjection.IServiceCollection" /> .
Returns A reference to this instance after the operation has completed.
services
The <see cref="T:Microsoft.Extensions.DependencyInjection.IServiceCollection" /> to add the service to.
serviceType
The type of the service to register.
implementationType
The implementation type of the service.
public static
IServiceCollection
AddTransient​(IServiceCollection services)
Adds a transient service of the type specified in <typeparamref name="TService" /> to the
specified <see cref="T:Microsoft.Extensions.DependencyInjection.IServiceCollection" /> .
Returns A reference to this instance after the operation has completed.
services
The <see cref="T:Microsoft.Extensions.DependencyInjection.IServiceCollection" /> to add the service to.
public static
IServiceCollection
AddTransient​(IServiceCollection services,
System.​Func<​System.​IServiceProvider, TService> implementationFactory)
Adds a transient service of the type specified in <typeparamref name="TService" /> with a
factory specified in <paramref name="implementationFactory" /> to the
specified <see cref="T:Microsoft.Extensions.DependencyInjection.IServiceCollection" /> .
Returns A reference to this instance after the operation has completed.
services
The <see cref="T:Microsoft.Extensions.DependencyInjection.IServiceCollection" /> to add the service to.
implementationFactory
The factory that creates the service.
public static
IServiceCollection
AddTransient​(IServiceCollection services)
Adds a transient service of the type specified in <typeparamref name="TService" /> with an
implementation type specified in <typeparamref name="TImplementation" /> to the
specified <see cref="T:Microsoft.Extensions.DependencyInjection.IServiceCollection" /> .
Returns A reference to this instance after the operation has completed.
services
The <see cref="T:Microsoft.Extensions.DependencyInjection.IServiceCollection" /> to add the service to.
public static
IServiceCollection
AddTransient​(IServiceCollection services,
System.​Func<​System.​IServiceProvider, TImplementation> implementationFactory)
Adds a transient service of the type specified in <typeparamref name="TService" /> with an
implementation type specified in <typeparamref name="TImplementation" /> using the
factory specified in <paramref name="implementationFactory" /> to the
specified <see cref="T:Microsoft.Extensions.DependencyInjection.IServiceCollection" /> .
Returns A reference to this instance after the operation has completed.
services
The <see cref="T:Microsoft.Extensions.DependencyInjection.IServiceCollection" /> to add the service to.
implementationFactory
The factory that creates the service.
public
bool
Equals​(object obj)
Inherited from object
protected
void
Finalize​()
Inherited from object
public
int
GetHashCode​()
Inherited from object
protected
object
MemberwiseClone​()
Inherited from object
public
string
ToString​()
Inherited from object