MetalamaAPI documentationAspect APIMetalama.​Framework.​ValidationIValidator­Receiver<TDeclaration>
Open sandboxFocus

IValidatorReceiver<TDeclaration> Interface

Represents a set of declarations to which validators, diagnostics, code fix suggestions, and options can be added.

Namespace: Metalama.Framework.Validation
Assembly: Metalama.Framework.dll
Syntax
[CompileTime]
public interface IValidatorReceiver<out TDeclaration> : IValidatorReceiver where TDeclaration : class, IDeclaration
Type Parameters
Name Description
TDeclaration

The type of declarations in the current set.

Methods

Name Description
AfterAllAspects()

Gets an interface that allows to validate the final compilation, after all aspects have been applied.

BeforeAnyAspect()

Gets an interface that allows to validate the initial compilation, after before any aspect has been applied.

ReportDiagnostic(Func<TDeclaration, IDiagnostic>)

Reports a diagnostic for each declaration selected by the the current object.

Select<TMember>(Func<TDeclaration, TMember>)

Selects a single member or the parent of the target declaration of the current aspect or fabric with the purpose of adding aspects, annotations or validators to them using e.g. AddAspectIfEligible<TAspect>(EligibleScenarios). Validate(ValidatorDelegate<DeclarationValidationContext>) or ValidateReferences(ValidatorDelegate<ReferenceValidationContext>, ReferenceKinds, Boolean).

SelectMany<TMember>(Func<TDeclaration, IEnumerable<TMember>>)

Selects members of the target declaration of the current aspect or fabric with the purpose of adding aspects, annotations or validators to them using e.g. AddAspectIfEligible<TAspect>(EligibleScenarios), Validate(ValidatorDelegate<DeclarationValidationContext>) or ValidateReferences(ValidatorDelegate<ReferenceValidationContext>, ReferenceKinds, Boolean).

SuggestCodeFix(Func<TDeclaration, CodeFix>)

Suggests a code fix for each declaration selected by the current object.

SuppressDiagnostic(Func<TDeclaration, SuppressionDefinition>)

Suppresses a diagnostic for each declaration selected by the current object.

ValidateReferences<TValidator>(Func<TDeclaration, TValidator>)

Registers a reference validator, provided by a delegate that provides an instance of the ReferenceValidator abstract class. The reference validator will be invoked to validate references to any declaration in the current set. Only source code references are validated. References added by aspects are ignored by design.

Where(Func<TDeclaration, Boolean>)

Filters the set of declarations included in the query.