Table of Contents

Class IServiceProviderExtensions

Namespace
Acuit.Pinpoint.Workflows
Assembly
Acuit.Pinpoint.Workflows.dll

Extension methods for IServiceProvider.

public static class IServiceProviderExtensions
Inheritance
IServiceProviderExtensions
Inherited Members

Methods

GetLogger<TCategoryName>(IServiceProvider)

Get a logger where the category name is derived from the specified TCategoryName type name.

public static ILogger<TCategoryName> GetLogger<TCategoryName>(this IServiceProvider serviceProvider)

Parameters

serviceProvider IServiceProvider

The service provider.

Returns

ILogger<TCategoryName>

The logger.

Type Parameters

TCategoryName

The type who's name is used for the logger category name.

Remarks

This will always return a logger. If serviceProvider does not provide one, a NullLogger<T> will be returned.

Exceptions

ArgumentNullException

serviceProvider is null.

GetRequiredService<T>(IServiceProvider)

Gets the service object of the specified type, throwing an exception if there is no service of that type.

public static T GetRequiredService<T>(this IServiceProvider serviceProvider)

Parameters

serviceProvider IServiceProvider

The service provider.

Returns

T

A service object of type T.

Type Parameters

T

The type of service object to get.

Exceptions

ArgumentNullException

serviceProvider is null.

InvalidOperationException

Required service of type T is not available.

GetService<T>(IServiceProvider)

Gets the service object of the specified type.

public static T GetService<T>(this IServiceProvider serviceProvider)

Parameters

serviceProvider IServiceProvider

The service provider.

Returns

T

A service object of type T, or null if there is no service object of type T.

Type Parameters

T

The type of service object to get.

Exceptions

ArgumentNullException

serviceProvider is null.