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

IAspectReceiver<TDeclaration> Interface

Represents a set of declarations and offers the ability to add aspects and set options to them. It inherits from IValidatorReceiver<TDeclaration>, which allows to add validators.

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

Methods

Name Description
AddAspect(Type, Func<TDeclaration, IAspect>)

Adds a aspect to the current set of declarations or throws an exception if the aspect is not eligible for the aspect. This overload is non-generic.

AddAspect<TAspect>()

Adds an aspect to the current set of declarations or throws an exception if the aspect is not eligible for the aspect. This overload creates a new instance of the aspect class for each target declaration.

AddAspect<TAspect>(Func<TDeclaration, TAspect>)

Adds an aspect to the current set of declarations or throws an exception if the aspect is not eligible for the aspect.

AddAspectIfEligible(Type, Func<TDeclaration, IAspect>, EligibleScenarios)

Adds an aspect to the current set of declarations but only if the aspect is eligible for the declaration. This overload is non-generic.

AddAspectIfEligible<TAspect>(EligibleScenarios)

Adds an aspect to the current set of declarations using the default constructor of the aspect type. This method does not verify the eligibility of the declaration for the aspect unless you specify the eligibility parameter. This overload creates a new instance of the aspect class for each eligible target declaration.

AddAspectIfEligible<TAspect>(Func<TDeclaration, TAspect>, EligibleScenarios)

Adds an aspect to the current set of declarations but only if the aspect is eligible for the declaration.

RequireAspect<TAspect>()

Requires an instance of a specified aspect type to be present on a specified declaration. If the aspect is not present, this method adds a new instance of the aspect by using the default aspect constructor.

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

Selects a 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).

SetOptions<TOptions>(TOptions)

Sets options for the declarations in the current set of declarations by supplying a System.Func<>.

SetOptions<TOptions>(Func<TDeclaration, TOptions>)

Sets options for the declarations in the current set of declarations by supplying a System.Func<>.

Where(Func<TDeclaration, Boolean>)

Filters the set of declarations included in the current set.