Open sandboxFocus

Class ParameterAspect

A base class for aspects that target method, constructor, or indexer parameter declarations.

Inheritance
ParameterAspect
Namespace: Metalama.Framework.Aspects
Assembly: Metalama.Framework.dll
Syntax
[AttributeUsage(AttributeTargets.Parameter)]
public abstract class ParameterAspect : Aspect, IAspect<IParameter>, IAspect, ICompileTimeSerializable, ITemplateProvider, IEligible<IParameter>
Remarks

This class provides a convenient base for creating parameter-level aspects by implementing IAspect<T> with T set to IParameter. Derived classes override BuildAspect(IAspectBuilder<IParameter>) to add advice (such as adding contracts for parameter validation, introducing attributes, or applying constraints) to the target parameter.

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<IParameter>) method.

This is a convenience base class. The aspect framework primarily requires implementation of IAspect<T>.

Constructors

Name Description
ParameterAspect()

Methods

Name Description
BuildAspect(IAspectBuilder<IParameter>)

Defines the aspect implementation by adding advice, child aspects, and validators to the target declaration.

BuildEligibility(IEligibilityBuilder<IParameter>)

Configures the eligibility of the aspect or attribute by defining rules that determine which declarations the aspect can be applied to.

Extension Methods

See Also