Specifies the templates that must be used for the get
accessor by the IAdviceFactory.OverrideAccessors
advice.
Namespace: Metalama.Framework.Advising
Assembly: Metalama.Framework.dll
Syntax
[CompileTime]
public readonly struct GetterTemplateSelector
Constructors
Name | Description |
---|---|
GetterTemplateSelector(string, string?, string?, bool) | 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 |
Operators
Name | Description |
---|---|
implicit operator GetterTemplateSelector(string?) | Converts a string to a new instance of the GetterTemplateSelector where the DefaultTemplate property is set to this string. |