Open sandboxFocus

Method AddAspect

AddAspect<TDeclaration>(IQuery<TDeclaration>, 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.

Declaration
public static void AddAspect<TDeclaration>(this IQuery<TDeclaration> query, Type aspectType, Func<TDeclaration, IAspect> createAspect) where TDeclaration : class, IDeclaration
Parameters
Type Name Description
IQuery<TDeclaration> query

A query selecting the declarations to validate.

Type aspectType

The exact type of the aspect returned by createAspect. It is not allowed to specify a base type in this parameter, only the exact type.

Func<TDeclaration, IAspect> createAspect

A function that returns the aspect for a given declaration.

Type Parameters
Name Description
TDeclaration

AddAspect<TDeclaration, TAspect>(IQuery<TDeclaration>, 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.

Declaration
public static void AddAspect<TDeclaration, TAspect>(this IQuery<TDeclaration> query, Func<TDeclaration, TAspect> createAspect) where TDeclaration : class, IDeclaration where TAspect : class, IAspect<TDeclaration>
Parameters
Type Name Description
IQuery<TDeclaration> query

A query selecting the declarations to validate.

Func<TDeclaration, TAspect> createAspect

A function that returns the aspect for a given declaration.

Type Parameters
Name Description
TDeclaration
TAspect

AddAspect<TAspect>(IQuery<IDeclaration>)

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.

Declaration
public static void AddAspect<TAspect>(this IQuery<IDeclaration> query) where TAspect : class, IAspect, new()
Parameters
Type Name Description
IQuery<IDeclaration> query
Type Parameters
Name Description
TAspect

AddAspect<TDeclaration, TTag>(ITaggedQuery<TDeclaration, TTag>, Type, Func<TDeclaration, TTag, 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.

Declaration
public static void AddAspect<TDeclaration, TTag>(this ITaggedQuery<TDeclaration, TTag> query, Type aspectType, Func<TDeclaration, TTag, IAspect> createAspect) where TDeclaration : class, IDeclaration
Parameters
Type Name Description
ITaggedQuery<TDeclaration, TTag> query

A query selecting the declarations to validate.

Type aspectType

The exact type of the aspect returned by createAspect. It is not allowed to specify a base type in this parameter, only the exact type.

Func<TDeclaration, TTag, IAspect> createAspect

A function that returns the aspect for a given declaration.

Type Parameters
Name Description
TDeclaration
TTag

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

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

Declaration
public static void AddAspect<TDeclaration, TTag, TAspect>(this ITaggedQuery<TDeclaration, TTag> query, Func<TDeclaration, TTag, TAspect> createAspect) where TDeclaration : class, IDeclaration where TAspect : class, IAspect<TDeclaration>
Parameters
Type Name Description
ITaggedQuery<TDeclaration, TTag> query

A query selecting the declarations to validate.

Func<TDeclaration, TTag, TAspect> createAspect

A function that returns the aspect for a given declaration.

Type Parameters
Name Description
TDeclaration
TTag
TAspect