Open sandboxFocus

Method BuildAspect

BuildAspect<T>(IAspectBuilder<T>, Action<IAspectBuilder<T>>?)

Implements the multicasting logic for a given declaration level. This method must be called from the BuildAspect(IAspectBuilder<T>) method of the aspect class.

Declaration
public void BuildAspect<T>(IAspectBuilder<T> builder, Action<IAspectBuilder<T>>? implementConcreteAspect = null) where T : class, IDeclaration
Parameters
Type Name Description
IAspectBuilder<T> builder

The IAspectBuilder<TAspectTarget> provided to the aspect's BuildAspect method.

Action<IAspectBuilder<T>> implementConcreteAspect

An optional action that implements the aspect's actual behavior. This delegate is called only when the current target is a final (concrete) target as specified by ConcreteTargets and matches the filtering criteria. For intermediate targets (assemblies, types), pass null or omit this parameter.

Type Parameters
Name Description
T

The type of the target declaration.

Remarks

This method performs two key operations:

  1. If the current target is a concrete target (as defined by ConcreteTargets) and matches the filtering criteria defined by IMulticastAttribute properties, it invokes the implementConcreteAspect delegate to apply the aspect's actual transformation.
  2. It propagates the aspect to matching child declarations based on the filtering criteria, enabling the cascading multicast behavior from assemblies to types to members.

If the AttributeExclude property is true on the current aspect instance, no transformation is applied and the aspect is skipped.