PostSharp//API Reference/Post­Sharp.​Aspects/Composition­Aspect
Open sandboxFocus

Class CompositionAspect

Aspect that, when applied on a type, introduces one or many new interfaces into that type.

Inheritance
CompositionAspect
Namespace: PostSharp.Aspects
Assembly: PostSharp.dll
Syntax
[MulticastAttributeUsage]
[AspectConfigurationAttributeType]
[Serializer]
public abstract class CompositionAspect : TypeLevelAspect, ITypeLevelAspectBuildSemantics, IAspectBuildSemantics, IValidableAnnotation, ICompositionAspect, ITypeLevelAspect, IAspect

Constructors

Name Description
CompositionAspect() PostSharp.Aspects.CompositionAspect

Properties

Name Description
AncestorOverrideAction

Specifies the action (Fail or Ignore) to be overtaken when an ancestor of one of the interfaces returned by GetPublicInterfaces(Type) is already implemented by the type to which the current aspect is applied.

GenerateImplementationAccessor

This property has no effect.

NonSerializedImplementation

Determines whether the field containing the interface implementation (and storing the object returned by CreateImplementationObject(AdviceArgs)) should be excluded from serialization by BinaryFormatter. The same effect is typically obtained by applying the NonSerializedAttribute custom attribute to the field.

OverrideAction

Specifies the action (Fail or Ignore) to be overtaken when one of the interfaces returned by the GetPublicInterfaces(Type) method is already implemented by the type to which the current aspect is applied.

Methods

Name Description
CreateAspectConfiguration()

Method invoked at build time to create a concrete AspectConfiguration instance specifically for the current Aspect type.

CreateImplementationObject(AdviceArgs)

Method invoked at runtime, during the initialization of instances of the target type, to create the composed object.

GetPublicInterfaces(Type)

Gets the array of interfaces that should be introduced publicly into the target type of the current aspect.

SetAspectConfiguration(AspectConfiguration, Type)

Method invoked at build time to set up an AspectConfiguration object according to the current Aspect instance and a specified target element of the current aspect.