Open sandboxFocusImprove this doc

Handling multiple aspect instances

When multiple aspects are applied to the same declaration, Metalama must determine how to handle them. There are two distinct scenarios:

Multiple aspect types on the same declaration

When you apply different aspect types to the same declaration (for example, [Log] and [Cache] on the same method), Metalama determines the execution order at run time. This is configured using the AspectOrderAttribute.

For details, see Ordering aspects.

Multiple instances of the same aspect type

When you apply multiple instances of the same aspect type to the same declaration (for example, via a custom attribute and a fabric), Metalama selects one instance as the primary and exposes the others as secondary instances. The primary instance can then access and merge configuration from secondary instances.

For details, see Multiple instances of the same aspect type.