The result of one call site whose call is 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 ForEachSite(Func<IMethodInterceptionSite, IMethodInterception>) can return.
Namespace: Metalama.Extensions.Interceptors
Assembly: Metalama.Extensions.Interceptors.dll
Syntax
[CompileTime]
[InternalImplement]
public interface ITemplateInterception : IMethodInterceptionRemarks
The result is used in the compilation in which it is created, and it is not kept, so its arguments can be any code model value. ITemplateRegistration is the counterpart of this interface for a result that applies to every call site.
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
|
| 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 |
| 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. |