-
Notifications
You must be signed in to change notification settings - Fork 5
RunAsync() Extensions
William David Cossey edited this page Jun 7, 2020
·
3 revisions
Run(object model = null)
RunAsync(object model = null)
Run<TModel>(TModel model = null)
RunAsync<TModel>(TModel model = null)public async Task RunAsyncSample()
{
RazorEngine razorEngine = new RazorEngine();
var template = await razorEngine.CompileAsync<RazorEngineCorePageModel>("@Model.Name");
var model = new
{
Name = "Alexander"
};
...
} string result = await template.RunAsync(model: model); // w/o RazorEngineCore.Extensions
string result = await template.RunAsync(instance =>
{
instance.Model = model;
});