The Razor template is a standard C# class, so you can freely use the functions of C#, such as `dependency injection`, using `LINQ`, custom methods, and even using `Repository`.
## Installation
It is suggested to use the [ABP CLI](CLI.md) to install this package.
@ -41,13 +45,34 @@ You need to add the `MetadataReference` of the type used in the template to `CSh
````csharp
public override void ConfigureServices(ServiceConfigurationContext context)
Before rendering a template, you should define it. Create a class inheriting from the `TemplateDefinitionProvider` base class:
@ -73,6 +98,11 @@ public class DemoTemplateDefinitionProvider : TemplateDefinitionProvider
* `/Demos/Hello/Hello.cshtml` is the path of the template file.
* `isInlineLocalized` is used to declare if you are using a single template for all languages (`true`) or different templates for each language (`false`). See the Localization section below for more.
### The Template Base
Every `cshtml` template page needs to inherit `RazorTemplatePageBase` or `RazorTemplatePageBase<Model>`.
There are some useful properties in the base class that can be used in templates. eg: `Localizer`, `ServiceProvider`.
### The Template Content
`WithVirtualFilePath` indicates that we are using the [Virtual File System](Virtual-File-System.md) to store the template content. Create a `Hello.cshtml` file inside your project and mark it as "**embedded resource**" on the properties window: