Open sandboxFocus

Interface ITemplateInterception

A method interception whose calls are redirected to a method synthesized from a template. Its methods set the options of the synthesized method. It is a complete interception, which the delegate given to InterceptMethods or to ForEachSite(Func<IMethodInterceptionSite, IMethodInterception>) can return.

Namespace: Metalama.Extensions.Interceptors
Assembly: Metalama.Extensions.Interceptors.dll
Syntax
[CompileTime]
[InternalImplement]
public interface ITemplateInterception : IMethodInterception
Remarks

The call sites whose synthesized methods have the same final signature, template, arguments, tags, placement and granularity share one synthesized method.

Methods

Name Description
Configure(Action<IInterceptorMethodBuilder>)

Adds a delegate that shapes the synthesized method for each call site, for instance to rename it, to change the type of a parameter, or to add a parameter and give its value at the call site.

PlaceInCallingType()

Synthesizes the method in the innermost type that contains the call site.

PlaceInStaticClass(string?)

Synthesizes the method in an internal static class that Metalama generates in the project. It is the default placement, with the class MetalamaInterceptors of the global namespace.

PlaceInType(INamedType)

Synthesizes the method in a given type of the current project.

PlaceInType(Type)

Synthesizes the method in a given type of the current project.

WithArgs(object)

Sets the arguments of the template.

WithGranularity(InterceptorGranularity)

Sets what the template depends on, and therefore which call sites share the synthesized method. The default value is Global.

WithTags(object)

Sets the object exposed to the template through meta.Tags.

WithTemplateProvider(TemplateProvider)

Sets the object or the type that declares the template. By default, it is the aspect or the fabric that makes the registration.

Extension Methods