Closed bezysoftware closed 4 years ago
I'm facing the same issue. As a work around use "UseFileSystemProject" and point it to an empty folder.
var engine = new RazorLightEngineBuilder().UseMemoryCachingProvider() .UseFileSystemProject(emptyFolderPath).Build();
@bezysoftware Are you referring to this snippet?
var engine = new RazorLightEngineBuilder()
.UseMemoryCachingProvider()
.Build();
string template = "Hello, @Model.Name. Welcome to RazorLight repository";
ViewModel model = new ViewModel() { Name = "John Doe" };
string result = await engine.CompileRenderAsync("templateKey", template, model);
Yep, that's the one. I actually resolved the issue by subclassing RazorLightProject
(with implementations throwing NotImplementedException
) and registering that with the builder. Since I provide the template as a string parameter, the flow never reaches this code and no exception is thrown. @jonny64bit 's solutions will probably work as well
Fixed. Please re-open if i missed something.
@bezysoftware Any chance you'd be willing to add code coverage for a UseStringProject() and a RazorLightStringProject class? I think that is the direction to go in, based on your feedback.
In beta2 it seems impossible to use the EngineBuilder without specifying a RazorLightProject. This should not be required as I can pass a template as a string in parametr