Open sandboxFocus

Namespace Metalama.Framework.Advising

Classes

AdviceResultExtensions

Extension methods for the IIntroductionAdviceResult<T> interface.

ConstructorOverloadingStrategy

Provides factory access to the standard implementations of the IConstructorOverloadingStrategy interface. Each factory returns a ForwardConstructorStrategy whose WithObsoleteAttribute(string?, bool) method can be used to additionally decorate the generated forwarding constructor with ObsoleteAttribute.

ForwardConstructorStrategy

A standard IConstructorOverloadingStrategy implementation that generates a forwarding constructor for matching source constructors, optionally decorated with ObsoleteAttribute so that callers are encouraged to migrate from the original signature to the new one. Obtain instances via ForwardSourceConstructors or ForwardDefaultConstructor, and add the obsolete decoration by calling WithObsoleteAttribute(string?, bool).

InterfaceImplementationAdviserExtensions

Provides extension methods for introducing explicit interface member implementations via IInterfaceImplementationAdviser.

PullStrategy

Provides factory methods for creating standard implementations of the IPullStrategy interface.

TemplateAttributeProperties

Represents a set of properties that configure how a T# template member should be introduced into target code. These properties allow overriding the name, accessibility, and modifiers of members introduced from templates. When a property is null, its value is inherited from the template member itself.

Structs

ConstructorOverloadingAction

Describes what an IConstructorOverloadingStrategy wants the framework to do with a mutated constructor: do nothing, generate a forwarding constructor to keep source and binary compatibility with the original constructor, or generate a forwarding constructor decorated with ObsoleteAttribute.

GetterTemplateSelector

Specifies which T# templates to use when overriding property or field getters, enabling automatic selection of specialized templates for iterator getters.

MethodTemplateSelector

Specifies which T# templates to use when overriding methods, enabling automatic selection of specialized templates based on the target method's characteristics (async, iterator, async iterator).

PullAction

Represents a way to pull a constructor parameter value from child constructors when propagating introduced parameters.

Interfaces

IAddContractAdviceResult<T>

Represents the result of an advice that adds a contract.

IAddInitializerAdviceResult

Represents the result of an advice that adds an initializer, returned by AddInitializer(IAdviser<IConstructor>, IStatement).

IAdviceAttribute

A marker interface for attributes that provide advice-related metadata. This interface serves as a common base for attributes that configure or describe members used in aspect-oriented programming scenarios, such as templates and declarative advice.

IAdviceFactory

Exposes all factory methods to create advice. Exposed on the Advice property of IAspectBuilder<TAspectTarget> or IAspectBuilder.

IAdviceResult

Represents the result of applying an advice (code transformation) through AdviserExtensions methods. Check the Outcome property to determine whether the advice was successfully applied.

IConstructorOverloadingStrategy

A strategy that decides whether the framework should generate an additional forwarding constructor when IntroduceParameter(IConstructor, string, IType, IPullStrategy?, ImmutableArray<AttributeConstruction>, IConstructorOverloadingStrategy?) mutates a constructor with a required parameter. A forwarding constructor is a compile-time stub that keeps the pre-mutation signature callable and chains via : this(...) to the now-mutated constructor, preserving both source and binary compatibility. For the standard implementation see ConstructorOverloadingStrategy.

IImplementInterfaceAdviceResult

Represents the result of ImplementInterface(IAdviser<INamedType>, INamedType, OverrideStrategy, object?) advice.

IInterfaceImplementationAdviser

Provides methods to introduce explicit interface member implementations.

IInterfaceImplementationResult

Describes an interface type implemented by advice, including the implementation outcome.

IInterfaceMemberImplementationResult

Describes how an individual interface member was implemented by advice.

IIntroductionAdviceResult<T>

Represents the result of introduction advice methods such as IntroduceMethod(IAdviser<INamedType>, string, IntroductionScope, OverrideStrategy, Action<IMethodBuilder>?, object?, object?), IntroduceProperty, IntroduceField, or IntroduceEvent.

IOverrideAdviceResult<T>

Represents the result of override advice, returned by methods such as OverrideAccessors(IAdviser<IFieldOrProperty>, in GetterTemplateSelector, string?, object?, object?).

IPullStrategy

A strategy that defines how the value of an introduced constructor parameter is obtained in two contexts: (a) the framework-emitted forwarding constructor that preserves the pre-mutation signature when IntroduceParameter(IConstructor, string, IType, IPullStrategy?, ImmutableArray<AttributeConstruction>, IConstructorOverloadingStrategy?) introduces a required parameter; and (b) chained constructors (in the same class) and derived constructors (in the same project or in referencing projects) that must pass a value to the mutated base constructor. For standard implementations, see PullStrategy.

IRemoveAttributesAdviceResult

Represents the result of an advice that removes attributes, returned by RemoveAttributes(IAdviser<IDeclaration>, INamedType).

ITemplateAttribute

Defines an interface for attributes that mark and configure T# template members. Template attributes allow you to override properties such as the name, accessibility, and modifiers (virtual, sealed, abstract, etc.) of members introduced from templates. When a property is not explicitly set, its value is inherited from the template member itself.

Enums

AdviceKind

Enumerates the different types of code transformations (advice) that can be applied by aspects. Each advice kind corresponds to a specific transformation operation available through AdviserExtensions.

AdviceOutcome

Indicates the result of applying an advice (code transformation). This enum is returned via Outcome by all advice methods to indicate whether the transformation succeeded, was ignored, or encountered an error.

InitializerKind

Specifies the kind of initializer that should be added by an advice operation.

InitializerPosition

Specifies the position of an initializer relative to the call to the base initializer, in advice operations that support it, i.e. AfterObjectInitializer and AfterLastInstanceConstructor.

InterfaceImplementationOutcome

Indicates the action taken by the advice when implementing an interface.

InterfaceMemberImplementationOutcome

Indicates the action taken by the advice when implementing an individual interface member.