AdviserExtensions.Override Method
Override(IAdviser<IMethod>, in MethodTemplateSelector, object?, object?)
Overrides the implementation of a method. Use the With<TNewDeclaration>(TNewDeclaration) method to apply the advice to another declaration than the current one.
Declaration
public static IOverrideAdviceResult<IMethod> Override(this IAdviser<IMethod> adviser, in MethodTemplateSelector template, object? args = null, object? tags = null)
Parameters
Type | Name | Description |
---|---|---|
IAdviser<IMethod> | adviser | An adviser for a method. |
MethodTemplateSelector | template | Name of a method in the aspect class whose implementation will be used as a template. This method must be annotated with TemplateAttribute. To select a different templates according to the kind of target method (such as async or iterator methods), use the constructor of the MethodTemplateSelector type. To specify a single template for all methods, pass a string. |
object | args | An object (typically of anonymous type) whose properties map to parameters or type parameters of the template method. |
object | tags | An optional opaque object of anonymous type passed to the template method and exposed under the Tags property of the meta API. |
Returns
Type | Description |
---|---|
IOverrideAdviceResult<IMethod> |
See Also
Override(IAdviser<IConstructor>, string, object?, object?)
Overrides the implementation of a constructor. Use the With<TNewDeclaration>(TNewDeclaration) method to apply the advice to another declaration than the current one.
Declaration
public static IOverrideAdviceResult<IConstructor> Override(this IAdviser<IConstructor> adviser, string template, object? args = null, object? tags = null)
Parameters
Type | Name | Description |
---|---|---|
IAdviser<IConstructor> | adviser | An adviser for a constructor. |
string | template | Name of a method in the aspect class whose implementation will be used as a template. This method must be annotated with TemplateAttribute. |
object | args | An object (typically of anonymous type) whose properties map to parameters or type parameters of the template method. |
object | tags | An optional opaque object of anonymous type passed to the template method and exposed under the Tags property of the meta API. |
Returns
Type | Description |
---|---|
IOverrideAdviceResult<IConstructor> |
Override(IAdviser<IFieldOrProperty>, string, object?)
Overrides a field or property by specifying a property template. Use the With<TNewDeclaration>(TNewDeclaration) method to apply the advice to another declaration than the current one.
Declaration
public static IOverrideAdviceResult<IProperty> Override(this IAdviser<IFieldOrProperty> adviser, string template, object? tags = null)
Parameters
Type | Name | Description |
---|---|---|
IAdviser<IFieldOrProperty> | adviser | An adviser for a property. |
string | template | The name of a property of the aspect class, with a getter, a setter, or both, whose implementation will be used as a template. This property must be annotated with TemplateAttribute. |
object | tags | An optional opaque object of anonymous type passed to the template property and exposed under the Tags property of the meta API. |
Returns
Type | Description |
---|---|
IOverrideAdviceResult<IProperty> |