A base class for aspects that target constructor declarations.
Implements
Namespace: Metalama.Framework.Aspects
Assembly: Metalama.Framework.dll
Syntax
[AttributeUsage(AttributeTargets.Constructor)]
public abstract class ConstructorAspect : Aspect, IAspect<IConstructor>, IAspect, ICompileTimeSerializable, ITemplateProvider, IEligible<IConstructor>Remarks
This class provides a convenient base for creating constructor-level aspects by implementing IAspect<T>
with T set to IConstructor. Derived classes override BuildAspect(IAspectBuilder<IConstructor>)
to add advice (such as overriding constructor implementations, adding initializers, introducing parameters, or adding contracts)
to the target constructor.
Aspects can only be applied to run-time code, never to compile-time types or their members. This eligibility restriction is enforced by the BuildEligibility(IEligibilityBuilder<IConstructor>) method.
This is a convenience base class. The aspect framework primarily requires implementation of IAspect<T>.
Constructors
| Name | Description |
|---|---|
| ConstructorAspect() |
Methods
| Name | Description |
|---|---|
| BuildAspect(IAspectBuilder<IConstructor>) | Defines the aspect implementation by adding advice, child aspects, and validators to the target declaration. |
| BuildEligibility(IEligibilityBuilder<IConstructor>) | Configures the eligibility of the aspect or attribute by defining rules that determine which declarations the aspect can be applied to. |