Class ServiceCollectionServiceExtensions
- Namespace
- Microsoft.Extensions.DependencyInjection
- Assembly
- nanoFramework.DependencyInjection.dll
Extension methods for adding services to an IServiceCollection.
public static class ServiceCollectionServiceExtensions
- Inheritance
-
ServiceCollectionServiceExtensions
- Inherited Members
Methods
AddScoped(IServiceCollection, Type)
Adds a scoped service of the type specified in serviceType
to the
specified IServiceCollection.
public static IServiceCollection AddScoped(this IServiceCollection services, Type serviceType)
Parameters
services
IServiceCollectionThe IServiceCollection to add the service to.
serviceType
TypeThe type of the service to register and the implementation to use.
Returns
- IServiceCollection
A reference to this instance after the operation has completed.
- See Also
AddScoped(IServiceCollection, Type, ImplementationFactoryDelegate)
Adds a scoped service of the type specified in serviceType
with a
factory specified in implementationFactory
to the
specified IServiceCollection.
public static IServiceCollection AddScoped(this IServiceCollection services, Type serviceType, ImplementationFactoryDelegate implementationFactory)
Parameters
services
IServiceCollectionThe IServiceCollection to add the service to.
serviceType
TypeThe type of the service to register.
implementationFactory
ImplementationFactoryDelegateThe factory that creates the service.
Returns
- IServiceCollection
A reference to this instance after the operation has completed.
- See Also
AddScoped(IServiceCollection, Type, Type)
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, Type implementationType)
Parameters
services
IServiceCollectionThe IServiceCollection to add the service to.
serviceType
TypeThe type of the service to register.
implementationType
TypeThe implementation type of the service.
Returns
- IServiceCollection
A reference to this instance after the operation has completed.
- See Also
AddSingleton(IServiceCollection, Type)
Adds a singleton service of the type specified in serviceType
to the
specified IServiceCollection.
public static IServiceCollection AddSingleton(this IServiceCollection services, Type serviceType)
Parameters
services
IServiceCollectionThe IServiceCollection to add the service to.
serviceType
TypeThe type of the service to register and the implementation to use.
Returns
- IServiceCollection
A reference to this instance after the operation has completed.
- See Also
AddSingleton(IServiceCollection, Type, ImplementationFactoryDelegate)
Adds a singleton service of the type specified in serviceType
with a
factory specified in implementationFactory
to the
specified IServiceCollection.
public static IServiceCollection AddSingleton(this IServiceCollection services, Type serviceType, ImplementationFactoryDelegate implementationFactory)
Parameters
services
IServiceCollectionThe IServiceCollection to add the service to.
serviceType
TypeThe type of the service to register.
implementationFactory
ImplementationFactoryDelegateThe factory that creates the service.
Returns
- IServiceCollection
A reference to this instance after the operation has completed.
- See Also
AddSingleton(IServiceCollection, Type, object)
Adds a singleton service of the type specified in serviceType
with an
instance specified in implementationInstance
to the
specified IServiceCollection.
public static IServiceCollection AddSingleton(this IServiceCollection services, Type serviceType, object implementationInstance)
Parameters
services
IServiceCollectionThe IServiceCollection to add the service to.
serviceType
TypeThe type of the service to register.
implementationInstance
objectThe instance of the service.
Returns
- IServiceCollection
A reference to this instance after the operation has completed.
- See Also
AddSingleton(IServiceCollection, Type, Type)
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, Type implementationType)
Parameters
services
IServiceCollectionThe IServiceCollection to add the service to.
serviceType
TypeThe type of the service to register.
implementationType
TypeThe implementation type of the service.
Returns
- IServiceCollection
A reference to this instance after the operation has completed.
- See Also
AddTransient(IServiceCollection, Type)
Adds a transient service of the type specified in serviceType
to the
specified IServiceCollection.
public static IServiceCollection AddTransient(this IServiceCollection services, Type serviceType)
Parameters
services
IServiceCollectionThe IServiceCollection to add the service to.
serviceType
TypeThe type of the service to register and the implementation to use.
Returns
- IServiceCollection
A reference to this instance after the operation has completed.
- See Also
AddTransient(IServiceCollection, Type, ImplementationFactoryDelegate)
Adds a transient service of the type specified in serviceType
with a
factory specified in implementationFactory
to the
specified IServiceCollection.
public static IServiceCollection AddTransient(this IServiceCollection services, Type serviceType, ImplementationFactoryDelegate implementationFactory)
Parameters
services
IServiceCollectionThe IServiceCollection to add the service to.
serviceType
TypeThe type of the service to register.
implementationFactory
ImplementationFactoryDelegateThe factory that creates the service.
Returns
- IServiceCollection
A reference to this instance after the operation has completed.
- See Also
AddTransient(IServiceCollection, Type, Type)
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, Type implementationType)
Parameters
services
IServiceCollectionThe IServiceCollection to add the service to.
serviceType
TypeThe type of the service to register.
implementationType
TypeThe implementation type of the service.
Returns
- IServiceCollection
A reference to this instance after the operation has completed.
- See Also