Table of Contents

Class ServiceProviderExtensions

Namespace
Codebelt.Extensions.Xunit.Hosting
Assembly
Codebelt.Extensions.Xunit.Hosting.dll

Provides extension methods for the IServiceProvider interface.

public static class ServiceProviderExtensions
Inheritance
ServiceProviderExtensions

Methods

GetRequiredScopedService<T>(IServiceProvider)

Gets a required scoped service of type T from the IServiceProvider.

public static T GetRequiredScopedService<T>(this IServiceProvider provider)

Parameters

provider IServiceProvider

The IServiceProvider to retrieve the service from.

Returns

T

The required service of type T.

Type Parameters

T

The type of the service to retrieve.

Exceptions

InvalidOperationException

There is no service of type T.