toddams / RazorLight

Template engine based on Microsoft's Razor parsing engine for .NET Core
Apache License 2.0
1.5k stars 259 forks source link

New method to render a template where its key is a type of the model #533

Closed sergei-boiko-stenn closed 6 months ago

sergei-boiko-stenn commented 9 months ago

New method CompileRenderModelAsync has been added- an ability to compile and render a template based on model instance only. So, as the template key in this case will be full or short type name of the model. Default option - engine use short type name, but this behaviour can be overriden in options (EnableModelFullTypeNameAsTemplateKey)

jzabroski commented 9 months ago

Can't this just be an extension method?

sergei-boiko-stenn commented 9 months ago

Can't this just be an extension method?

Sure, it can. Feel free to decline PR.