A registration 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 can return. It is the counterpart of
ITemplateInterception for a result that applies to every call site.
Namespace: Metalama.Extensions.Interceptors
Assembly: Metalama.Extensions.Interceptors.dll
Syntax
[CompileTime]
[InternalImplement]
public interface ITemplateRegistration : IMethodInterceptionRemarks
The registration is kept across compilations, so its arguments, its tags, its template provider and its Configure(Action<IInterceptorMethodBuilder>) delegates must be durable. The arguments are resolved in the compilation of each 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(ITemplateProvider) | Sets the object that declares the template. By default, it is the aspect or the fabric that makes the registration. |
| WithTemplateProvider<T>() | Sets the type that declares the template, which is then a static method. |