I have created following simple Razor View:
EmailTemplates/Reset.cshtml:
@model ResetTemplateDto
Rest email @Model.Title
I have called this razor view something like this (via RazorLight):
I am loading Razor Views like EmbeddedResources
:
var engine = new RazorLightEngineBuilder()
.UseEmbeddedResourcesProject(typeof(Program))
.UseMemoryCachingProvider()
.Build();
string result = await _razorLightEngine.CompileRenderAsync("EmailTemplates.Reset", new ResetTemplateDto
{
Title = "Test"
});
If I call this request for the first time this action takes perhaps 4-5s, another calls take 100ms.
Is there any solution how to load razor views without this first long request?