Metalama 1.0 / / Metalama Documentation / Aspect API / Metalama.​Framework.​Advising / Getter­Template­Selector

Class GetterTemplateSelector

Specifies the templates that must be used for the get accessor by the IAdviceFactory.OverrideAccessors advice.

Inheritance
GetterTemplateSelector
Namespace: Metalama.Framework.Advising
Assembly: Metalama.Framework.dll
Syntax
[CompileTime]
public sealed class GetterTemplateSelector : ValueType

Constructors

Name Description
GetterTemplateSelector(String, String, String, Boolean)

Initializes a new instance of the GetterTemplateSelector 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
DefaultTemplate

Gets the name of the template that must be applied if no other template is applicable. This property is required if you want to override the getter.

EnumerableTemplate

Gets the name of the template that must be applied to iterator getters returning an IEnumerable<T> or IEnumerable.

EnumeratorTemplate

Gets the name of the template that must be applied to iterator getters returning an IEnumerator<T> or IEnumerator.

UseEnumerableTemplateForAnyEnumerable

Gets a value indicating whether the EnumerableTemplate or EnumeratorTemplate must be applied to all methods returning compatible return type, instead of only to methods using the yield statement.

Operators

Name Description
Implicit(String to GetterTemplateSelector)

Converts a String to a new instance of the GetterTemplateSelector where the DefaultTemplate property is set to this string.