Metalama (preview)API 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.

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.

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.

OfType<TOut>()
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.

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

Projects each declaration of the current set to an IEnumerable<T> (typically a list of child declarations) and flattens the resulting sequences into one set.

SelectTypes(bool)

Selects all types enclosed in declarations of the current set.

SelectTypesDerivedFrom(INamedType, DerivedTypesOptions)

Selects all types, among those enclosed in declarations of the current set, that derive from or implement a given INamedType.

SelectTypesDerivedFrom(Type, DerivedTypesOptions)

Selects all types, among those enclosed in declarations of the current set, that derive from or implement a given Type.

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

Projects each declaration of the current set into a new declaration.

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

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

SetOptions<TOptions>(TOptions)

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

Tag<TTag>(Func<TDeclaration, TTag>)

Projects the declarations in the current set by adding a tag for each declaration, and returns a IValidatorReceiver<TDeclaration, TTag>. Methods of this interface have overloads that accept this tag.

Where(Func<TDeclaration, bool>)

Filters the set of declarations based on a predicate.