Open sandboxFocus

Enum EligibleScenarios

A flags enumeration of scenarios in which an aspect can be used, controlling whether aspects are eligible for direct application, inheritance, or live templates. Values can be combined using bitwise operators.

Namespace: Metalama.Framework.Eligibility
Assembly: Metalama.Framework.dll
Syntax
[CompileTime]
[Flags]
public enum EligibleScenarios
Remarks

This is a flags enumeration (marked with FlagsAttribute), allowing fine-grained control over aspect eligibility across different usage scenarios. Individual scenario values can be combined using bitwise OR (|), and checked using bitwise AND (&). Use methods like ForScenarios<T>(IEligibilityBuilder<T>, EligibleScenarios) or ExceptForScenarios<T>(IEligibilityBuilder<T>, EligibleScenarios) to restrict eligibility to specific scenarios.

The most common scenario is Default, which represents direct application of aspects to declarations. Use Inheritance to control eligibility for derived or overridden declarations, and LiveTemplate for IDE code generation scenarios. The All value is the combination of all scenarios.

Fields

Name Description
All

The aspect or option can be used in any scenario: direct application, inheritance, and as a live template.

Aspect
Default

The aspect or option can be directly applied to the target declaration.

Inheritance

The aspect or option can be applied to declarations that are derived from or override the target declaration, but not directly to the target declaration itself.

LiveTemplate

The aspect or option can be used as a live template on the target declaration for IDE code generation.

None

The aspect or option cannot be applied to the target declaration in any scenario: not for direct application, not for inheritance, and not as a live template.

See Also