Open sandboxFocus

Method ExceptForScenarios

ExceptForScenarios<T>(IEligibilityBuilder<T>, EligibleScenarios)

Gets an IEligibilityBuilder for the same declaration as the given IEligibilityBuilder but that is not applicable to specified EligibleScenarios.

Declaration
public static IEligibilityBuilder<T> ExceptForScenarios<T>(this IEligibilityBuilder<T> eligibilityBuilder, EligibleScenarios excludedScenarios) where T : class
Parameters
Type Name Description
IEligibilityBuilder<T> eligibilityBuilder

The parent eligibility builder.

EligibleScenarios excludedScenarios

The scenarios to exclude from eligibility. This is a flags enumeration and can be a combination of scenarios (e.g., EligibleScenarios.Inheritance | EligibleScenarios.LiveTemplate).

Returns
Type Description
IEligibilityBuilder<T>

An eligibility builder that excludes the specified scenarios.

Type Parameters
Name Description
T

The type of declaration being validated.

Remarks

Use this method to exclude specific scenarios from eligibility. Rules added to the returned builder will mark the declaration as ineligible for the specified scenarios. This is useful when you want to prevent aspects from being applied in certain contexts (e.g., excluding inheritance scenarios).

This is the opposite of ForScenarios<T>(IEligibilityBuilder<T>, EligibleScenarios) which restricts to specific scenarios only.

See Also