Skip to content

Can I Render a template from a database? #79

Answered by soundaranbu
michaelakin asked this question in Q&A
Discussion options

You must be logged in to vote

Hello,

  1. Yes, it's possible. You might want to take a look at this sample project https://github.com/soundaranbu/Razor.Templating.Core/tree/feature/custom-razor-file-provider/examples/_RealWorldSamples/RazorTemplateEditor where it's saving the view in the database and then uses it to render the template based on the given input
  2. The new HtmlRenderer introduced in .NET 8 is based on razor components(.razor) whereas this library utilizes the View files(.cshtml) with concepts similar to MVC but allows it render anywhere outside of the HttpContext (except the browser)

I hope that answers your question!

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@michaelakin
Comment options

Answer selected by michaelakin
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants