Table of Contents

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 IServiceCollection

The IServiceCollection to add the service to.

serviceType Type

The 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 IServiceCollection

The IServiceCollection to add the service to.

serviceType Type

The type of the service to register.

implementationFactory ImplementationFactoryDelegate

The 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 IServiceCollection

The IServiceCollection to add the service to.

serviceType Type

The type of the service to register.

implementationType Type

The 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 IServiceCollection

The IServiceCollection to add the service to.

serviceType Type

The 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 IServiceCollection

The IServiceCollection to add the service to.

serviceType Type

The type of the service to register.

implementationFactory ImplementationFactoryDelegate

The 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 IServiceCollection

The IServiceCollection to add the service to.

serviceType Type

The type of the service to register.

implementationInstance object

The 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 IServiceCollection

The IServiceCollection to add the service to.

serviceType Type

The type of the service to register.

implementationType Type

The 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 IServiceCollection

The IServiceCollection to add the service to.

serviceType Type

The 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 IServiceCollection

The IServiceCollection to add the service to.

serviceType Type

The type of the service to register.

implementationFactory ImplementationFactoryDelegate

The 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 IServiceCollection

The IServiceCollection to add the service to.

serviceType Type

The type of the service to register.

implementationType Type

The implementation type of the service.

Returns

IServiceCollection

A reference to this instance after the operation has completed.

See Also