Project "Caravela" 0.3 / / Caravela Documentation / Conceptual Documentation / Creating Aspects / Adding Child Aspects

Adding child aspects

An aspect can add other aspects to children declarations. Such aspects are called child aspects. Child aspects must satisfy two conditions:

  • The child aspect class must be processed after the parent aspect class, i.e. the child aspect class must be positioned before the parent class in the AspectOrderAttribute ordering definition. See Ordering Aspects for details.
  • The target declaration of the child aspect class must be contained in the target type of the parent aspect. For instance, a type-level aspect can add aspects to methods of the current type, but not to methods of a different type. A parameter-level aspect can add a child aspect to the parent method or to another method of the same type, but not of a different type.

Parent aspects are listed in the IAspectInstance.Predecessors property, which the child aspect can access from meta.AspectInstance or builder.AspectInstance.

TODO: Example