Open sandboxFocus

Class DurableTemplateInvocation

Represents an invocation of a template method that can be kept across compilations. It is the durable counterpart of TemplateInvocation.

Inheritance
DurableTemplateInvocation
Namespace: Metalama.Framework.Aspects
Assembly: Metalama.Framework.dll
Syntax
[CompileTime]
[Durable]
public sealed class DurableTemplateInvocation
Remarks

Use this type where an API keeps a template invocation after the compilation in which it was created, for instance a registration that is evaluated again in each new compilation. Use TemplateInvocation everywhere else.

The values of Arguments must be durable. A declaration or a type must be passed as a durable reference (see ToDurableRef<T>(T)), and an expression must be passed as a durable expression (see ToDurable(IExpression)). Literals, enumeration values and Type values are durable. A durable reference or a durable expression is resolved in the compilation in which the template is expanded, so that the template receives the declaration, the type or the IExpression of that compilation.

Constructors

Name Description
DurableTemplateInvocation(string, ITemplateProvider, object?)

Initializes a new instance of the DurableTemplateInvocation class for a template of a given ITemplateProvider.

DurableTemplateInvocation(string, object?)

Initializes a new instance of the DurableTemplateInvocation class for a template of the current template provider.

Properties

Name Description
Arguments

Gets the object whose properties map to parameters or type parameters of the template, or null.

TemplateName

Gets the name of the called template method.

TemplateProvider

Gets the TemplateProvider where the template is found, or default for the current template provider.

Methods

Name Description
FromType<T>(string, object?)

Creates a DurableTemplateInvocation for a static template declared by a given type.

Extension Methods

See Also