Open sandboxFocus

Interface IEligibilityRule<T>

Encapsulates a predicate determining the eligibility of an object (typically a declaration or a type) across different scenarios.

Namespace: Metalama.Framework.Eligibility
Assembly: Metalama.Framework.dll
Syntax
[CompileTime]
public interface IEligibilityRule<in T> where T : class
Type Parameters
Name Description
T

The type of object that the rule evaluates (typically an IDeclaration or derived type).

Remarks

User code typically does not implement this interface directly. Instead, use MustSatisfy<T>(IEligibilityBuilder<T>, Predicate<T>, Func<IDescribedObject<T>, FormattableString>) or other extension methods from EligibilityExtensions to create rules declaratively.

This interface is used internally by the eligibility system to evaluate whether a declaration meets the requirements for aspect application in various scenarios (direct application, inheritance, live templates).

Methods

Name Description
GetEligibility(T)

Determines the eligibility of a given object for the aspect or option.

GetIneligibilityJustification(EligibleScenarios, IDescribedObject<T>)

Gets a human-readable explanation for why the GetEligibility(T) method denied eligibility in a requested scenario.

Extension Methods

See Also