Class ServiceLocatorExtensions
Extension methods for IService
Inheritance
System.Object
ServiceLocatorExtensions
Namespace: EPiServer.ServiceLocation
Assembly: EPiServer.Framework.dll
Version: 12.0.3Syntax
public static class ServiceLocatorExtensions : Object
Methods
GetAllInstances<TService>(IServiceLocator)
Get all instances of the given TService
currently
registered in the container.
Declaration
public static IEnumerable<TService> GetAllInstances<TService>(this IServiceLocator serviceLocator)
Parameters
Type | Name | Description |
---|---|---|
IService |
serviceLocator |
Returns
Type | Description |
---|---|
System. |
A sequence of instances of the requested |
Type Parameters
Name | Description |
---|---|
TService | Type of object requested. |
Exceptions
Type | Condition |
---|---|
Activation |
if there is are errors resolving the service instance. |
TryGetExistingInstance<TService>(IServiceLocator, out TService)
Tries to get an existing instance of the given TService
.
Declaration
public static bool TryGetExistingInstance<TService>(this IServiceLocator serviceLocator, out TService instance)
Parameters
Type | Name | Description |
---|---|---|
IService |
serviceLocator | The locator that is being extended |
TService | instance | The requested service instance or null if it do not exist |
Returns
Type | Description |
---|---|
System. |
True if the instance was found |
Type Parameters
Name | Description |
---|---|
TService | Type of object requested. |
Exceptions
Type | Condition |
---|---|
Activation |
if there is are errors resolving the service instance. |