Class BuilderServicesExtensions
Extension methods for Microsoft.Extensions.DependencyInjection.IServiceCollection and System.IServiceProvider used by builder classes.
Inheritance
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 |
---|---|---|
System.IServiceProvider | services | Service provider to resolve logger from. |
Returns
Type | Description |
---|---|
Microsoft.Extensions.Logging.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 |
---|---|---|
System.IServiceProvider | services | Service provider to resolve logger from. |
Returns
Type | Description |
---|---|
Microsoft.Extensions.Logging.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 |
---|---|---|
Microsoft.Extensions.DependencyInjection.IServiceCollection | services | Service collection to search in. |
Returns
Type | Description |
---|---|
System.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 |
---|---|---|
Microsoft.Extensions.DependencyInjection.IServiceCollection | services | Service collection to remove service from. |
Type Parameters
Name | Description |
---|---|
TService | Service type. |
TryGetDescriptor<TService>(IServiceCollection, out ServiceDescriptor)
Tries to get Microsoft.Extensions.DependencyInjection.ServiceDescriptor for service of given type.
Declaration
public static bool TryGetDescriptor<TService>(this IServiceCollection services, out ServiceDescriptor result)
Parameters
Type | Name | Description |
---|---|---|
Microsoft.Extensions.DependencyInjection.IServiceCollection | services | Service collection to search in. |
Microsoft.Extensions.DependencyInjection.ServiceDescriptor | result | The found service descriptor. |
Returns
Type | Description |
---|---|
System.Boolean | True if service was found; otherwise false. |
Type Parameters
Name | Description |
---|---|
TService | Service type. |