Metalama (preview)API documentationExtensions APIMetalama.​Extensions.​Architecture.​PredicatesReference­Predicate
Open sandboxFocus

ReferencePredicate Class

The base class for predicates that applies to a ReferenceValidationContext. Standard extension methods are provided on ReferencePredicateExtensions. You can create your own predicates by deriving a new class from this one and exposing the API as a extension methods of ReferencePredicateBuilder.

Inheritance
ReferencePredicate
Namespace: Metalama.Extensions.Architecture.Predicates
Assembly: Metalama.Extensions.Architecture.dll
Syntax
public abstract class ReferencePredicate : ICompileTimeSerializable
Remarks

This class implements ICompileTimeSerializable. All predicates must therefore be serializable.

Constructors

Name Description
ReferencePredicate(ReferencePredicateBuilder)

Initializes a new instance of the ReferencePredicate class and provides a ReferencePredicateBuilder.

Properties

Name Description
Builder

Gets the ReferencePredicateBuilder from which the current predicate was built, or null if the object was null without a ReferencePredicateBuilder.

Granularity

Gets the granularity including the modifiers such as And, Or or Not.

Methods

Name Description
GetGranularity()

Gets the granularity of validation required by this predicate, effect ignoring any modifier such as And, Or or Not. For instance, if the predicate only compares the namespace, it should return Namespace.

IsMatch(ReferenceValidationContext)

Gets a value indicating whether the predicate matches the given ReferenceValidationContext, taking the optional modifier (e.g. an And, Or or Not modifier).

IsMatchCore(ReferenceValidationContext)

Gets a value indicating whether the current predicate matches the given ReferenceValidationContext, ignoring any modifier such as And, Or or Not.

Extension Methods

ReferencePredicateExtensions.And(ReferencePredicate)
ReferencePredicateExtensions.And(ReferencePredicate, ReferencePredicate)
ReferencePredicateExtensions.And(ReferencePredicate, Func<ReferencePredicateBuilder, ReferencePredicate>)
ReferencePredicateExtensions.Not(ReferencePredicate)
ReferencePredicateExtensions.Or(ReferencePredicate)
ReferencePredicateExtensions.Or(ReferencePredicate, ReferencePredicate?)
ReferencePredicateExtensions.Or(ReferencePredicate, Func<ReferencePredicateBuilder, ReferencePredicate>)