Interface IServiceLocator
The generic Service Locator interface. This interface is used to retrieve services (instances identified by type and optional name) from a container.
Inherited Members
Namespace: EPiServer.ServiceLocation
Assembly: EPiServer.Framework.dll
Version: 10.10.4Syntax
public interface IServiceLocator : IServiceProviderRemarks
This derives from http://commonservicelocator.codeplex.com/.
Methods
Buildup(Object)
Satisfies the dependencies of the given service using setter injection.
Declaration
void Buildup(object service)Parameters
| Type | Name | Description | 
|---|---|---|
| System.Object | service | The object whose property depdenencies should be set. | 
GetAllInstances(Type)
Get all instances of the given serviceType currently
registered in the container.
Declaration
IEnumerable<object> GetAllInstances(Type serviceType)Parameters
| Type | Name | Description | 
|---|---|---|
| System.Type | serviceType | Type of object requested. | 
Returns
| Type | Description | 
|---|---|
| System.Collections.Generic.IEnumerable<System.Object> | A sequence of instances of the requested  | 
Exceptions
| Type | Condition | 
|---|---|
| ActivationException | if there is are errors resolving the service instance. | 
GetAllInstances<TService>()
Get all instances of the given TService currently
registered in the container.
Declaration
IEnumerable<TService> GetAllInstances<TService>()Returns
| Type | Description | 
|---|---|
| System.Collections.Generic.IEnumerable<TService> | A sequence of instances of the requested  | 
Type Parameters
| Name | Description | 
|---|---|
| TService | Type of object requested. | 
Exceptions
| Type | Condition | 
|---|---|
| ActivationException | if there is are errors resolving the service instance. | 
GetInstance(Type)
Get an instance of the given serviceType.
Declaration
object GetInstance(Type serviceType)Parameters
| Type | Name | Description | 
|---|---|---|
| System.Type | serviceType | Type of object requested. | 
Returns
| Type | Description | 
|---|---|
| System.Object | The requested service instance. | 
Exceptions
| Type | Condition | 
|---|---|
| ActivationException | if there is an error resolving the service instance. | 
GetInstance(Type, String)
Get an instance of the given named serviceType.
Declaration
object GetInstance(Type serviceType, string key)Parameters
| Type | Name | Description | 
|---|---|---|
| System.Type | serviceType | Type of object requested. | 
| System.String | key | Name the object was registered with. | 
Returns
| Type | Description | 
|---|---|
| System.Object | The requested service instance. | 
Exceptions
| Type | Condition | 
|---|---|
| ActivationException | if there is an error resolving the service instance. | 
GetInstance<TService>()
Get an instance of the given TService.
Declaration
TService GetInstance<TService>()Returns
| Type | Description | 
|---|---|
| TService | The requested service instance. | 
Type Parameters
| Name | Description | 
|---|---|
| TService | Type of object requested. | 
Exceptions
| Type | Condition | 
|---|---|
| ActivationException | if there is are errors resolving the service instance. | 
GetInstance<TService>(String)
Get an instance of the given named TService.
Declaration
TService GetInstance<TService>(string key)Parameters
| Type | Name | Description | 
|---|---|---|
| System.String | key | Name the object was registered with. | 
Returns
| Type | Description | 
|---|---|
| TService | The requested service instance. | 
Type Parameters
| Name | Description | 
|---|---|
| TService | Type of object requested. | 
Exceptions
| Type | Condition | 
|---|---|
| ActivationException | if there is are errors resolving the service instance. | 
TryGetExistingInstance(Type, out Object)
Tries to get an existing instance of the given serviceType.
Declaration
bool TryGetExistingInstance(Type serviceType, out object instance)Parameters
| Type | Name | Description | 
|---|---|---|
| System.Type | serviceType | Type of object requested. | 
| System.Object | instance | 
Returns
| Type | Description | 
|---|---|
| System.Boolean | True if the instance was found | 
Exceptions
| Type | Condition | 
|---|---|
| ActivationException | if there is an error resolvingThe requested service instance or null if it do not exist the service instance. | 
TryGetExistingInstance(Type, String, out Object)
Tries to get an existing instance of the given named serviceType.
Declaration
bool TryGetExistingInstance(Type serviceType, string key, out object instance)Parameters
| Type | Name | Description | 
|---|---|---|
| System.Type | serviceType | Type of object requested. | 
| System.String | key | Name the object was registered with. | 
| System.Object | instance | The requested service instance or null if it do not exist | 
Returns
| Type | Description | 
|---|---|
| System.Boolean | True if the instance was found | 
Exceptions
| Type | Condition | 
|---|---|
| ActivationException | if there is an error resolving the service instance. | 
TryGetExistingInstance<TService>(out TService)
Tries to get an existing instance of the given TService.
Declaration
bool TryGetExistingInstance<TService>(out TService instance)Parameters
| Type | Name | Description | 
|---|---|---|
| TService | instance | The requested service instance or null if it do not exist | 
Returns
| Type | Description | 
|---|---|
| System.Boolean | True if the instance was found | 
Type Parameters
| Name | Description | 
|---|---|
| TService | Type of object requested. | 
Exceptions
| Type | Condition | 
|---|---|
| ActivationException | if there is are errors resolving the service instance. | 
TryGetExistingInstance<TService>(String, out TService)
Tries to get an existing instance of the given named TService.
Declaration
bool TryGetExistingInstance<TService>(string key, out TService instance)Parameters
| Type | Name | Description | 
|---|---|---|
| System.String | key | Name the object was registered with. | 
| TService | instance | The requested service instance or null if it do not exist | 
Returns
| Type | Description | 
|---|---|
| System.Boolean | True if the instance was found | 
Type Parameters
| Name | Description | 
|---|---|
| TService | Type of object requested. | 
Exceptions
| Type | Condition | 
|---|---|
| ActivationException | if there is are errors resolving the service instance. | 
