November Happy Hour will be moved to Thursday December 5th.

Class StructureMapServiceLocatorExtensions

Extension methods for IServiceLocator that is available for structuremap implementation

Inheritance
System.Object
StructureMapServiceLocatorExtensions
Inherited Members
System.Object.ToString()
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
Namespace: EPiServer.ServiceLocation
Assembly: EPiServer.Framework.dll
Version: 10.10.4
Syntax
public static class StructureMapServiceLocatorExtensions

Methods

Buildup(IServiceLocator, Object)

Satisfies the dependencies of the given service using setter injection.

Declaration
public static void Buildup(this IServiceLocator serviceLocator, object service)
Parameters
Type Name Description
IServiceLocator serviceLocator

The servicelocator that is extended

System.Object service

The object whose property depdenencies should be set.

GetInstance(IServiceLocator, Type, String)

Get an instance of the given named serviceType.

Declaration
public static object GetInstance(this IServiceLocator serviceLocator, Type serviceType, string key)
Parameters
Type Name Description
IServiceLocator serviceLocator

The servicelocator that is extended

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>(IServiceLocator, String)

Get an instance of the given named TService.

Declaration
public static TService GetInstance<TService>(this IServiceLocator serviceLocator, string key)
Parameters
Type Name Description
IServiceLocator serviceLocator

The servicelocator that is extended

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(IServiceLocator, Type, String, out Object)

Tries to get an existing instance of the given named serviceType.

Declaration
public static bool TryGetExistingInstance(this IServiceLocator serviceLocator, Type serviceType, string key, out object instance)
Parameters
Type Name Description
IServiceLocator serviceLocator

The servicelocator that is extended

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>(IServiceLocator, String, out TService)

Tries to get an existing instance of the given named TService.

Declaration
public static bool TryGetExistingInstance<TService>(this IServiceLocator serviceLocator, string key, out TService instance)
Parameters
Type Name Description
IServiceLocator serviceLocator

The servicelocator that is extended

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.