Class BuilderServicesExtensions
Extension methods for IServiceCollection and IServiceProvider used by builder classes.
Namespace: TehGM.Wolfringo.Utilities.Internal
Assembly: Wolfringo.Core.dll
Syntax
public static class BuilderServicesExtensions
Methods
| Improve this Doc View SourceGetLoggerFor<TService>(IServiceProvider)
Gets the most matching logger for a service.
Declaration
public static ILogger GetLoggerFor<TService>(this IServiceProvider services)
Parameters
Type | Name | Description |
---|---|---|
IServiceProvider | services | Service provider to resolve logger from. |
Returns
Type | Description |
---|---|
ILogger | The most matching logger found; can still return null if none was found. |
Type Parameters
Name | Description |
---|---|
TService | Service type. |
GetLoggerFor<TService, TImplementation>(IServiceProvider)
Gets the most matching logger for a service.
Declaration
public static ILogger GetLoggerFor<TService, TImplementation>(this IServiceProvider services)
where TImplementation : TService
Parameters
Type | Name | Description |
---|---|---|
IServiceProvider | services | Service provider to resolve logger from. |
Returns
Type | Description |
---|---|
ILogger | The most matching logger found; can still return null if none was found. |
Type Parameters
Name | Description |
---|---|
TService | Service type. |
TImplementation | Implementation type. |
HasService<TService>(IServiceCollection)
Checks if service of given type is added to service collection.
Declaration
public static bool HasService<TService>(this IServiceCollection services)
Parameters
Type | Name | Description |
---|---|---|
IServiceCollection | services | Service collection to search in. |
Returns
Type | Description |
---|---|
Boolean | True if service was found; otherwise false. |
Type Parameters
Name | Description |
---|---|
TService | Service type. |
RemoveService<TService>(IServiceCollection)
Removes a service of given type.
Declaration
public static void RemoveService<TService>(this IServiceCollection services)
Parameters
Type | Name | Description |
---|---|---|
IServiceCollection | services | Service collection to remove service from. |
Type Parameters
Name | Description |
---|---|
TService | Service type. |
TryGetDescriptor<TService>(IServiceCollection, out ServiceDescriptor)
Tries to get ServiceDescriptor for service of given type.
Declaration
public static bool TryGetDescriptor<TService>(this IServiceCollection services, out ServiceDescriptor result)
Parameters
Type | Name | Description |
---|---|---|
IServiceCollection | services | Service collection to search in. |
ServiceDescriptor | result | The found service descriptor. |
Returns
Type | Description |
---|---|
Boolean | True if service was found; otherwise false. |
Type Parameters
Name | Description |
---|---|
TService | Service type. |