Metalama 1.0 / / Metalama Documentation / Aspect API / Metalama.​Framework.​Eligibility / Eligibility­Extensions / Must­Satisfy

Method MustSatisfy

MustSatisfy<T>(IEligibilityBuilder<T>, Predicate<T>, Func<IDescribedObject<T>, FormattableString>)

Adds a condition to the given IEligibilityBuilder, where the condition must be satisfied by the declaration in order to be eligible for the aspect. The new rule is given as a Predicate<T>.

Declaration
public static void MustSatisfy<T>(this IEligibilityBuilder<T> eligibilityBuilder, Predicate<T> predicate, Func<IDescribedObject<T>, FormattableString> getJustification)
where T : class
Parameters
Type Name Description
IEligibilityBuilder<T> eligibilityBuilder

The parent IEligibilityBuilder.

Predicate<T> predicate

A predicate that returns true if the declaration is eligible for the aspect.

Func<IDescribedObject<T>, FormattableString> getJustification

A delegate called in case predicate returns false and when the justification of the non-ineligibility is required. This delegate must return a FormattableString, i.e. a C# interpolated string ($"like {this}").

Type Parameters
Name Description
T

MustSatisfy<T>(IEligibilityBuilder<T>, Action<IEligibilityBuilder<T>>)

Adds a condition to the given IEligibilityBuilder, where the condition must be satisfied by the declaration in order to be eligible for the aspect. The new rule is built using a child IEligibilityBuilder.

Declaration
public static void MustSatisfy<T>(this IEligibilityBuilder<T> eligibilityBuilder, Action<IEligibilityBuilder<T>> requirement)
where T : class
Parameters
Type Name Description
IEligibilityBuilder<T> eligibilityBuilder
Action<IEligibilityBuilder<T>> requirement
Type Parameters
Name Description
T