Class DecoratorBasedServiceResolutionInfo
A model for a series of SingleObjectResolutionInfo which describes 'a decorator stack'.
Inheritance
Inherited Members
Namespace: CSF.DecoratorBuilder
Assembly: CSF.DecoratorBuilder.Abstractions.dll
Syntax
public class DecoratorBasedServiceResolutionInfo
Remarks
A service created using the decorator pattern is a series of service objects, each wrapping the one which precedes it. See https://en.wikipedia.org/wiki/Decorator_pattern for more info but a good analogy are Russian Matryoshka dolls, each doll contains another. Likewise, with services created using the decorator pattern, each object which implements the service interface wraps another object that implements the same interface. Only one object in the overall service does not wrap an object of the same interface.
To create a service that uses the decorator pattern a queue of services-to-resolve is specified. When resolving each of these services, that resolved object is passed as a dependency to the resolution of the next service in the queue.
Constructors
| Improve this Doc View SourceDecoratorBasedServiceResolutionInfo(Type)
Initialises a new instance of DecoratorBasedServiceResolutionInfo.
Declaration
public DecoratorBasedServiceResolutionInfo(Type serviceType)
Parameters
Type | Name | Description |
---|---|---|
System.Type | serviceType | The service type. |
Exceptions
Type | Condition |
---|---|
System.ArgumentNullException | If |
Properties
| Improve this Doc View SourceServicesToResolve
Gets a collection of specifications for each of the individual objects to resolve in order to create the overall service.
Declaration
public Queue<SingleObjectResolutionInfo> ServicesToResolve { get; }
Property Value
Type | Description |
---|---|
System.Collections.Generic.Queue<SingleObjectResolutionInfo> |
Remarks
The first item in this queue must represent a 'plain' service type (which is not itself a decorator). All subsequent items must be decorator types.
ServiceType
Gets the type of the service to create using the decorator pattern. This should generally be an interface or abstract class.
Declaration
public Type ServiceType { get; }
Property Value
Type | Description |
---|---|
System.Type |