Class DecoratedServiceFactory
Implementation of IGetsDecoratedService which creates an appropriate builder, applies customisations and returns the resolved service, created using the decorator pattern.
Inheritance
Implements
Inherited Members
Namespace: CSF.DecoratorBuilder
Assembly: CSF.DecoratorBuilder.Common.dll
Syntax
public class DecoratedServiceFactory : IGetsDecoratedService
Constructors
| Improve this Doc View SourceDecoratedServiceFactory(IGetsDecoratedServiceFromResolutionInfo)
Initialises a new instance of DecoratedServiceFactory.
Declaration
public DecoratedServiceFactory(IGetsDecoratedServiceFromResolutionInfo resolver)
Parameters
Type | Name | Description |
---|---|---|
IGetsDecoratedServiceFromResolutionInfo | resolver | An object which resolves services from a DecoratorBasedServiceResolutionInfo. |
Exceptions
Type | Condition |
---|---|
System.ArgumentNullException | If |
Methods
| Improve this Doc View SourceGetDecoratedService(Type, Func<ICreatesDecorator, ICustomizesDecorator>, ITypedResolvable[])
Builds and returns an instance of a service, using the decorator pattern.
Declaration
public object GetDecoratedService(Type serviceType, Func<ICreatesDecorator, ICustomizesDecorator> customizationFunc, params ITypedResolvable[] globalParams)
Parameters
Type | Name | Description |
---|---|---|
System.Type | serviceType | The service type, typically an interface. |
System.Func<ICreatesDecorator, ICustomizesDecorator> | customizationFunc | A customization function, to build the 'shape' of the decorated service. |
ITypedResolvable[] | globalParams | An optional collection of resolution parameters, to be applied to every resolution operation. |
Returns
Type | Description |
---|---|
System.Object | The service instance. |
GetDecoratedService<TService>(Func<ICreatesDecorator<TService>, ICustomizesDecorator<TService>>, ITypedResolvable[])
Builds and returns an instance of a service, using the decorator pattern.
Declaration
public TService GetDecoratedService<TService>(Func<ICreatesDecorator<TService>, ICustomizesDecorator<TService>> customizationFunc, params ITypedResolvable[] globalParams)
where TService : class
Parameters
Type | Name | Description |
---|---|---|
System.Func<ICreatesDecorator<TService>, ICustomizesDecorator<TService>> | customizationFunc | A customization function, to build the 'shape' of the decorated service. |
ITypedResolvable[] | globalParams | An optional collection of resolution parameters, to be applied to every resolution operation. |
Returns
Type | Description |
---|---|
TService | The service instance. |
Type Parameters
Name | Description |
---|---|
TService | The service type, typically an interface. |