A base class for aspects that target event declarations.
Namespace: Metalama.Framework.Aspects
Assembly: Metalama.Framework.dll
Syntax
[AttributeUsage(AttributeTargets.Event)]
public abstract class EventAspect : Aspect, IAspect<IEvent>, IAspect, ICompileTimeSerializable, ITemplateProvider, IEligible<IEvent>Remarks
This class provides a convenient base for creating event-level aspects by implementing IAspect<T>
with T set to IEvent. Derived classes override BuildAspect(IAspectBuilder<IEvent>)
to add advice (such as overriding event accessors or invoke semantics, adding attributes, or introducing related members)
to the target event.
For aspects that specifically override event semantics (add, remove, or invoke operations) with templates, consider deriving from OverrideEventAspect instead, which provides a simpler template-based API for overriding event add, remove, and invoke operations.
Aspects can only be applied to run-time code, never to compile-time types or their members. This eligibility restriction is enforced by the BuildEligibility(IEligibilityBuilder<IEvent>) method.
This is a convenience base class. The aspect framework primarily requires implementation of IAspect<T>.
Constructors
| Name | Description |
|---|---|
| EventAspect() |
Methods
| Name | Description |
|---|---|
| BuildAspect(IAspectBuilder<IEvent>) | Defines the aspect implementation by adding advice, child aspects, and validators to the target declaration. |
| BuildEligibility(IEligibilityBuilder<IEvent>) | Configures the eligibility of the aspect or attribute by defining rules that determine which declarations the aspect can be applied to. |