Open sandboxFocus

Method ExceptForInheritance

ExceptForInheritance<T>(IEligibilityBuilder<T>)

Gets an IEligibilityBuilder for the same declaration as the given IEligibilityBuilder but that is not applicable when the aspect is inheritable and is applied to a declaration that can be inherited or overridden.

Declaration
public static IEligibilityBuilder<T> ExceptForInheritance<T>(this IEligibilityBuilder<T> eligibilityBuilder) where T : class
Parameters
Type Name Description
IEligibilityBuilder<T> eligibilityBuilder

The parent eligibility builder.

Returns
Type Description
IEligibilityBuilder<T>

An eligibility builder that excludes the Inheritance scenario.

Type Parameters
Name Description
T

The type of declaration being validated.

Remarks

This is a convenience method equivalent to calling ExceptForScenarios(EligibleScenarios.Inheritance). Use it to prevent aspects from being eligible on derived or overridden declarations when the aspect is marked with InheritableAttribute.

See Also