Namespace: Metalama.Framework.Aspects
Assembly: Metalama.Framework.dll
Syntax
[InternalImplement]
[CompileTime]
public interface IAspectInstance : IAspectPredecessorRemarks
Use Cases:
- Accessing the current aspect instance: In the BuildAspect(IAspectBuilder<T>) method, access the current aspect instance via AspectInstance to retrieve aspect-specific information such as AspectClass, AspectState, SecondaryInstances, or Predecessors.
-
In templates: Access the current aspect instance via
meta.AspectInstanceto retrieve aspect-specific information during code generation. - Querying aspects on declarations: Retrieve aspect instances applied to any declaration using GetAspectInstances() to inspect which aspects have been applied and their state. This can only query aspects that have already been applied or are being applied (e.g., aspects ordered before the current one, or instances of the current aspect applied in a parent class).
- In aspect predecessor chains: When examining Predecessors, predecessor instances can be cast to IAspectInstance when Kind indicates an aspect relationship.
Properties
| Name | Description |
|---|---|
| Aspect | Gets the aspect instance. |
| AspectClass | Gets the aspect type. |
| AspectState | Gets the optional opaque object defined by the aspect for the specific TargetDeclaration using the AspectState property of the IAspectBuilder interface. |
| IsInheritable | Gets a value indicating whether the current aspect instance can be inherited by derived declarations. |
| IsSkipped | Gets a value indicating whether the current aspect instance has been skipped. This value is |
| SecondaryInstances | Gets the other instances of the same AspectClass on the same TargetDeclaration. When several instances of the same AspectClass are found on the same TargetDeclaration, they are ordered by priority, and only the first one (the primary instance) gets executed. The other instances are exposed on this property. |