Skip to main content

Definition

Assembly: Microsoft.Extensions.DependencyInjection.Abstractions.dll Namespace: Microsoft.Extensions.DependencyInjection

Syntax

Summary

This type is defined in Microsoft.Extensions.DependencyInjection.Abstractions.

Remarks

See Microsoft documentation for more information about the rest of the API.

Methods

AddChainedService Extension

Extension method from Microsoft.Extensions.DependencyInjection.ServiceCollectionExtensions
A Restier-specific method that adds a “service contributor”, which has a chance to chain previously registered service instances. DO NOT use this method outside of a Restier app.

Syntax

Parameters

Returns

Type: Microsoft.Extensions.DependencyInjection.IServiceCollection The services instance modified with the new TService reference.

Type Parameters

Remarks

This process is being deprecated. Please DO NOT rely on it for future behavior in your own apps. V2 will properly handle multiple instances of a registration by firing them in succession.

AddChainedService Extension

Extension method from Microsoft.Extensions.DependencyInjection.ServiceCollectionExtensions
A Restier-specific method that adds a “service contributor”, which has a chance to chain previously registered service instances. DO NOT use this method outside of a Restier app.

Syntax

Parameters

Returns

Type: Microsoft.Extensions.DependencyInjection.IServiceCollection Current IServiceCollection

Type Parameters

  • TService - The service type to register with the IServiceCollection.
  • TImplement - The implementation type.

Remarks

This process is being deprecated. Please DO NOT rely on it for future behavior in your own apps. V2 will properly handle multiple instances of a registration by firing them in succession. If want to cutoff previous registration, not define a property with type of TService or do not use it. The contributor added will get an instance of TImplement from the container, i.e. IServiceProvider, every time it’s get called. This method will try to register TImplement as a service with Transient life time, if it’s not yet registered. To override, you can register TImplement before or after calling this method. Note: When registering TImplement, you must NOT give it a ServiceLifetime that makes it outlives TService, that could possibly make an instance of TImplement be used in multiple instantiations of TService, which leads to unpredictable behaviors.

AddEF6ProviderServices Extension

Extension method from Microsoft.Extensions.DependencyInjection.RestierEntityFrameworkServiceCollectionExtensions
This method is used to add entity framework providers service into container.

Syntax

Parameters

Returns

Type: Microsoft.Extensions.DependencyInjection.IServiceCollection Current IServiceCollection.

Type Parameters

  • TDbContext - The DbContext type.

AddEFCoreProviderServices Extension

Extension method from Microsoft.Extensions.DependencyInjection.RestierEntityFrameworkServiceCollectionExtensions
This method is used to add entity framework providers service into container.

Syntax

Parameters

Returns

Type: Microsoft.Extensions.DependencyInjection.IServiceCollection Current IServiceCollection.

Type Parameters

  • TDbContext - The DbContext type.

HasService Extension

Extension method from Microsoft.Extensions.DependencyInjection.ServiceCollectionExtensions
Return true if the IServiceCollection has any TService service registered.

Syntax

Parameters

Returns

Type: bool A Boolean specifying whether or not the TService

Type Parameters

HasServiceCount Extension

Extension method from Microsoft.Extensions.DependencyInjection.ServiceCollectionExtensions
Returns the number of services that match the given ServiceType in a given ServiceCollection.

Syntax

Parameters

Returns

Type: int An Int32 representing the number of Services that match the given ServiceType.

Type Parameters