Update (I forgot everything about it)
I asked this question earlier (which led me to create RazorEngine) Pulling a view from a database, not a file
I know at least two: RazorEngine , MvcMailer
I have a bias towards RazorEngine since I worked on this, but I have a lot easier on Github called RazorSharp (although it only supports C #)
All of them are pretty easy to use.
RazorEngine:
string result = RazorEngine.Razor.Parse(razorTemplate, new { Name = "World" });
Mvcmailer
I have not used this, so I can not help.
Razorsharp
RazorSharp also supports master pages.
string result = RazorSharp.Razor.Parse(new { Name = "World" }, razorTemplate, masterTemplate);
Neither RazorSharp nor RazorEngine support any of the Mvc helpers such as Html
and Url
. Because these libraries must exist outside of Mvc and therefore require more work to get them to work with these helpers. I canβt say anything about MvcMailer, but I suspect the situation is the same.
I hope for this help.
source share