Click or drag to resize

AutofacMultitenantServiceProviderExtensionsGetAutofacMultitenantRoot Method

Note: This API is now obsolete.

Tries to cast the instance of MultitenantContainer from AutofacServiceProvider when possible.

Namespace:  Autofac.Integration.AspNetCore.Multitenant
Assembly:  Autofac.Integration.AspNetCore.Multitenant (in Autofac.Integration.AspNetCore.Multitenant.dll) Version: 4.0.1+b60273783824e015af81d477fca338eb146578d7
Syntax
[ObsoleteAttribute("This function will be removed in a future release. Please use IServiceProvider.GetRequiredService<MultitenantContainer>() instead.")]
public static MultitenantContainer GetAutofacMultitenantRoot(
	this IServiceProvider serviceProvider
)

Parameters

serviceProvider
Type: SystemIServiceProvider
The instance of IServiceProvider.

Return Value

Type: MultitenantContainer
Returns the instance of MultitenantContainer exposed by AutofacServiceProvider when it can be casted down from ILifetimeScope.

Usage Note

In Visual Basic and C#, you can call this method as an instance method on any object of type IServiceProvider. When you use instance method syntax to call this method, omit the first parameter. For more information, see Extension Methods (Visual Basic) or Extension Methods (C# Programming Guide).
Exceptions
ExceptionCondition
InvalidOperationException Thrown if serviceProvider can't be casted to MultitenantContainer.
See Also