MetalamaAPI documentationPost­Sharp API migrationPost­Sharp.​AspectsCustom­Attribute­Introduction­Aspect
Open sandboxFocus

CustomAttributeIntroductionAspect Class

There is no specific aspect class to add a custom attribute in Metalama, but only the advice factory method IntroduceAttribute(IDeclaration, IAttributeData, OverrideStrategy). Create an aspect class that calls this advice factory method from BuildAspect(IAspectBuilder<T>).

Inheritance
CustomAttributeIntroductionAspect
Namespace: PostSharp.Aspects
Assembly: Metalama.Migration.dll
Syntax
[LinesOfCodeAvoided(1)]
public sealed class CustomAttributeIntroductionAspect : Object, ICustomAttributeIntroductionAspect, IAspect, IAspectBuildSemantics, IValidableAnnotation

Constructors

Name Description
CustomAttributeIntroductionAspect(ObjectConstruction)
CustomAttributeIntroductionAspect(CustomAttributeData)

Properties

Name Description
CustomAttribute

Explicit Interface Implementations

Name Description
IAspectBuildSemantics.GetAspectConfiguration(Object)
IValidableAnnotation.CompileTimeValidate(Object)

In Metalama, validation is done in BuildEligibility(IEligibilityBuilder<T>) and BuildAspect(IAspectBuilder<T>). The equivalent of returning false is to call SkipAspect().