Class AutofacDecoratedServiceFactory
Implementation of IGetsAutofacDecoratedService 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.Autofac.dll
Syntax
public class AutofacDecoratedServiceFactory : IGetsAutofacDecoratedService
Constructors
| Improve this Doc View SourceAutofacDecoratedServiceFactory(IGetsDecoratedServiceFromResolutionInfo)
Initialises a new instance of AutofacDecoratedServiceFactory.
Declaration
public AutofacDecoratedServiceFactory(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<ICreatesAutofacDecorator, ICustomizesAutofacDecorator>, Parameter[])
Builds and returns an instance of a service, using the decorator pattern.
Declaration
public object GetDecoratedService(Type serviceType, Func<ICreatesAutofacDecorator, ICustomizesAutofacDecorator> customizationFunc, params Parameter[] globalParams)
Parameters
Type | Name | Description |
---|---|---|
System.Type | serviceType | The service type, typically an interface. |
System.Func<ICreatesAutofacDecorator, ICustomizesAutofacDecorator> | customizationFunc | A customization function, to build the 'shape' of the decorated service. |
Autofac.Core.Parameter[] | 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<ICreatesAutofacDecorator<TService>, ICustomizesAutofacDecorator<TService>>, Parameter[])
Builds and returns an instance of a service, using the decorator pattern.
Declaration
public TService GetDecoratedService<TService>(Func<ICreatesAutofacDecorator<TService>, ICustomizesAutofacDecorator<TService>> customizationFunc, params Parameter[] globalParams)
where TService : class
Parameters
Type | Name | Description |
---|---|---|
System.Func<ICreatesAutofacDecorator<TService>, ICustomizesAutofacDecorator<TService>> | customizationFunc | A customization function, to build the 'shape' of the decorated service. |
Autofac.Core.Parameter[] | 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. |