Open sandboxFocus

Enum ApplyChangesAxis

Enumerates the axes along which two option layers can be merged by the ApplyChanges(object, in ApplyChangesContext) method. Understanding these axes is important when customizing how options are inherited and merged across different declaration levels.

Namespace: Metalama.Framework.Options
Assembly: Metalama.Framework.dll
Syntax
[CompileTime]
public enum ApplyChangesAxis
Remarks

When options are resolved for a declaration, Metalama merges options from multiple sources in a specific order. Each merging step occurs along one of these axes, which determines the precedence and priority of the options being combined.

The general priority order (from lowest to highest precedence) is: default options, namespace options, base type/member options, containing type options, and finally options on the target declaration itself. Options provided by aspects have the highest priority.

Aspect authors can disable inheritance along specific axes by using the HierarchicalOptionsAttribute on their option class.

Fields

Name Description
Aspect

Indicates that options provided by an aspect instance (via IHierarchicalOptionsProvider) are being applied. Options along this axis have the highest priority and override all other options.

BaseDeclaration

Indicates that options from a base type or overridden member are being applied to a derived type or overriding member. Options along this axis have lower priority than namespace-level options and default options from the base project.

ContainingDeclaration

Indicates that options from a containing declaration (such as a declaring type) are being applied to a nested declaration (such as a member). This also applies when namespace-level options override default project options. For instance, type-level options on the declaring type of an override method override method-level options inherited from the base method.

SameDeclaration

Indicates that options from multiple sources (custom attributes, fabrics, aspects) are being merged for the same declaration. This axis is used when combining options defined at the same declaration level before inheritance rules apply.

TargetDeclaration

Indicates that options directly applied to the target declaration are overriding options inherited from containing declarations, base declarations, or default options. This axis represents the final application of declaration-specific options.

See Also