FromType<T>()
Creates a TemplateProvider from a type that implements ITemplateProvider.
Declaration
public static TemplateProvider FromType<T>() where T : ITemplateProviderReturns
| Type | Description |
|---|---|
| TemplateProvider | A TemplateProvider that references the specified type. |
Type Parameters
| Name | Description |
|---|---|
| T | A type that implements ITemplateProvider and contains template methods
(methods annotated with TemplateAttribute). The type must not be |
Remarks
Use this method when you want to invoke templates from a class that is not the current aspect or fabric.
The type T must implement ITemplateProvider (which is an empty marker interface)
and contain one or more template methods.
Important: The type T is never instantiated. This means:
- No constructor is required on
T - Instance members of
Tare not accessible from the template - Templates in
Tmust bestaticmethods
If you need to invoke instance templates or access instance state, use FromInstance(ITemplateProvider?) instead, passing an actual instance of the template provider.