SaaS CMS has officially launched! Learn more now.

Class ServiceLocator

This class provides the ambient container for this application. If your framework defines such an ambient container, use ServiceLocator.Current to get it.

Inheritance
System.Object
ServiceLocator
Namespace: EPiServer.ServiceLocation
Assembly: EPiServer.Framework.dll
Version: 12.0.3
Syntax
public static class ServiceLocator : Object
Remarks

Properties

Current

The current ambient container.

Declaration
public static IServiceProvider Current { get; }
Property Value
Type Description
System.IServiceProvider

Methods

SetScopedServiceProvider(IServiceProvider)

Set the scoped provider resolver is used to retrieve the current container.

Declaration
public static void SetScopedServiceProvider(IServiceProvider serviceProvider)
Parameters
Type Name Description
System.IServiceProvider serviceProvider

Service provider.

SetServiceProvider(IServiceProvider)

Set the provider resolver is used to retrieve the current container.

Declaration
public static void SetServiceProvider(IServiceProvider serviceProvider)
Parameters
Type Name Description
System.IServiceProvider serviceProvider

Service provider.