Class RazorTemplateService
Provides methods for rendering Razor templates.
Implements
Inherited Members
Namespace: DataWeb .Templating
Assembly: DataWeb.Core.dll
Syntax
public class RazorTemplateService : IRazorTemplateService
Remarks
Initializes a new instance of the Razor
Constructors
RazorTemplateService(IRazorViewEngine, ITempDataProvider, IServiceProvider)
Provides methods for rendering Razor templates.
Declaration
public RazorTemplateService(IRazorViewEngine viewEngine, ITempDataProvider tempDataProvider, IServiceProvider serviceProvider)
Parameters
Type | Name | Description |
---|---|---|
IRazor |
viewEngine | The Razor view engine. |
ITemp |
tempDataProvider | The temporary data provider. |
IService |
serviceProvider | The service provider. |
Remarks
Initializes a new instance of the Razor
Methods
RenderAsync(string, object, CancellationToken)
Renders the specified Razor template with the given model.
Declaration
public Task<string> RenderAsync(string name, object model, CancellationToken cancellationToken = default)
Parameters
Type | Name | Description |
---|---|---|
string | name | The name of the template to render. |
object | model | The model to pass to the template. |
Cancellation |
cancellationToken |
Returns
RenderAsync(string, CancellationToken)
Renders the specified Razor template.
Declaration
public Task<string> RenderAsync(string name, CancellationToken cancellationToken = default)
Parameters
Type | Name | Description |
---|---|---|
string | name | The name of the template to render. |
Cancellation |
cancellationToken |