Class ServiceLocator
- Namespace
- Dynamicweb.Extensibility.Providers
- Assembly
- Dynamicweb.Extensibility.dll
This class is a helper that provides a default implementation
for most of the methods of IServiceLocator .
- Inheritance
-
Service
Locator
- Implements
- Inherited Members
Methods
DoGetAllInstances(Type)
When implemented by inheriting classes, this method will do the actual work of
resolving all the requested service instances.
Parameters
serviceType
Type- Type of service requested.
Returns
- IEnumerable<object>
- Sequence of service instance objects.
DoGetInstance(Type, string)
When implemented by inheriting classes, this method will do the actual work of resolving
the requested service instance.
Parameters
serviceType
Type- Type of instance requested.
key
string- Name of registered service you want. May be null.
Returns
- object
- The requested service instance.
FormatActivateAllExceptionMessage(Exception, Type)
Format the exception message for use in an ActivationException
that occurs while resolving multiple service instances.
[Obsolete("Use FormatActivationExceptionMessage instead.")]
protected virtual string FormatActivateAllExceptionMessage(Exception actualException, Type serviceType)
Parameters
actualException
Exception- The actual exception thrown by the implementation.
serviceType
Type- Type of service requested.
Returns
- string
- The formatted exception message string.
FormatActivationExceptionMessage(Exception, Type, string)
Format the exception message for use in an ActivationException
that occurs while resolving a single service.
protected virtual string FormatActivationExceptionMessage(Exception actualException, Type serviceType, string key)
Parameters
actualException
Exception- The actual exception thrown by the implementation.
serviceType
Type- Type of service requested.
key
string- Name requested.
Returns
- string
- The formatted exception message string.
GetAllInstances(Type)
Get all instances of the given
serviceType
currently
registered in the container.Parameters
serviceType
Type- Type of object requested.
Returns
- IEnumerable<object>
- A sequence of instances of the requested
serviceType
.
Exceptions
- Activation
Exception - if there is are errors resolving the service instance.
GetAllInstances<TService>()
Get all instances of the given
TService
currently
registered in the container.Returns
- IEnumerable<TService>
- A sequence of instances of the requested
TService
.
Type Parameters
TService
- Type of object requested.
Exceptions
- Activation
Exception - if there is are errors resolving the service instance.
GetInstance(Type)
Get an instance of the given
serviceType
.Parameters
serviceType
Type- Type of object requested.
Returns
- object
- The requested service instance.
Exceptions
- Activation
Exception - if there is an error resolving the service instance.
GetInstance(Type, string)
Get an instance of the given named
serviceType
.Parameters
Returns
- object
- The requested service instance.
Exceptions
- Activation
Exception - if there is an error resolving the service instance.
GetInstance<TService>()
Get an instance of the given
TService
.Returns
- TService
- The requested service instance.
Type Parameters
TService
- Type of object requested.
Exceptions
- Activation
Exception - if there is are errors resolving the service instance.
GetInstance<TService>(string)
Get an instance of the given named
TService
.Parameters
key
string- Name the object was registered with.
Returns
- TService
- The requested service instance.
Type Parameters
TService
- Type of object requested.
Exceptions
- Activation
Exception - if there is are errors resolving the service instance.
GetService(Type)
Implementation of GetService(Type) .
Parameters
serviceType
Type- The requested service.
Returns
- object
- The requested object.
Exceptions
- Activation
Exception - if there is an error in resolving the service instance.