Open sandboxFocus

Method ForScenarios

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

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

Declaration
public static IEligibilityBuilder<T> ForScenarios<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 for which the following rules should apply. This is a flags enumeration and can be a combination of scenarios (e.g., EligibleScenarios.Default | EligibleScenarios.Inheritance).

Returns
Type Description
IEligibilityBuilder<T>

An eligibility builder that applies only to the specified scenarios.

Type Parameters
Name Description
T

The type of declaration being validated.

Remarks

Use this method to restrict eligibility rules to specific scenarios. Rules added to the returned builder will only be evaluated for the specified scenarios. This is useful when you want different eligibility requirements for different scenarios.

This is the opposite of ExceptForScenarios<T>(IEligibilityBuilder<T>, EligibleScenarios) which excludes specific scenarios.

See Also