Open sandboxFocus

Class ReferenceValidator

Namespace: Metalama.Framework.Validation
Assembly: Metalama.Framework.dll
Syntax
[Obsolete("Use OutboundReferenceValidator.")]
public abstract class ReferenceValidator : InboundReferenceValidator, ICompileTimeSerializable

Constructors

Name Description
ReferenceValidator()

Properties

Name Description
Granularity

Gets level of declarations at which the analysis should be performed. For instance, if the ValidateReferences(ReferenceValidationContext) method only depends on the namespace of the referencing syntax (as opposed to its declaring member or type), then Granularity should be set to Namespace, and ValidateReferences(ReferenceValidationContext) will be invoked a single time per namespace.

IncludeDerivedTypes

Gets a value indicating whether references to derived types should also be visited by the ValidateReferences(ReferenceValidationContext) method. This property is only evaluated when the validated declaration is an INamedType.

ValidatedReferenceKinds

Gets the kinds of references for which the ValidateReferences(ReferenceValidationContext) method should be invoked. For optimal performance, the set should be restricted to its required minimum. Flags that are not compatible with the validated kind of declarations are automatically ignored.

Methods

Name Description
Validate(in ReferenceValidationContext)
ValidateReferences(ReferenceValidationContext)

Validates the references in the given context. The context may contain several references, all grouped according to the validator Granularity. The implementation is reponsible for reporting diagnostics as necessary.