Specifies the templates that must be used by the IAdviceFactory.Override(IMethod)
advice.
Namespace: Metalama.Framework.Advising
Assembly: Metalama.Framework.dll
Syntax
[CompileTime]
public readonly struct MethodTemplateSelector
Constructors
Name | Description |
---|---|
MethodTemplateSelector(string, string?, string?, string?, string?, string?, bool, bool) | Initializes a new instance of the MethodTemplateSelector struct by specifying the name of the template methods to be applied. The named passed to this constructor must be the name of methods of the current aspect class, and these methods must be annotated with the TemplateAttribute custom attribute. You can define several templates by passing a value to optional parameters. The appropriate template will be automatically selected according to the method to which the advice is applied. If several templates are eligible for a method, the template that is the last in the list of parameters is selected. |
Properties
Name | Description |
---|---|
AsyncEnumerableTemplate | Gets the name of the template that must be applied to an async iterator method returning the |
AsyncEnumeratorTemplate | Gets the name of the template that must be applied to an async iterator method returning the |
AsyncTemplate | Gets the name of the template that must be applied to async methods, including async iterators (unless AsyncEnumerableTemplate
or AsyncEnumeratorTemplate is defined).
If UseAsyncTemplateForAnyAwaitable is set to |
DefaultTemplate | Gets the name of the template that must be applied if no other template is applicable. This property is required. |
EnumerableTemplate | Gets the name of the template that must be applied to yield-based iterator methods returning an IEnumerable<T> or IEnumerable.
If the UseEnumerableTemplateForAnyEnumerable is set to |
EnumeratorTemplate | Gets the name of the template that must be applied to yield-based iterator methods returning an IEnumerator<T> or IEnumerator.
If the UseEnumerableTemplateForAnyEnumerable is set to |
UseAsyncTemplateForAnyAwaitable | Gets a value indicating whether the AsyncTemplate must be applied to all methods returning an awaitable type (including |
UseEnumerableTemplateForAnyEnumerable | Gets a value indicating whether the EnumerableTemplate, EnumeratorTemplate, AsyncEnumerableTemplate,
AsyncEnumeratorTemplate must be applied to all methods returning a compatible return type (if set to |
Operators
Name | Description |
---|---|
implicit operator MethodTemplateSelector(string) | Converts a string to a new instance of the MethodTemplateSelector where the DefaultTemplate property is set to this string. |