Show / Hide Table of Contents

Class DecoratorBasedServiceResolutionInfo

A model for a series of SingleObjectResolutionInfo which describes 'a decorator stack'.

Inheritance
System.Object
DecoratorBasedServiceResolutionInfo
Inherited Members
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.ToString()
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 Source

DecoratorBasedServiceResolutionInfo(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 serviceType is null.

Properties

| Improve this Doc View Source

ServicesToResolve

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.

| Improve this Doc View Source

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
  • Improve this Doc
  • View Source
In This Article
Back to top Generated by DocFX