Question

I wonder if there is any way to extend razor view engine capabilities to handle some custom text/tag and parse/proceed before render. Assume that I use some special tag which is ${} as below:

<span>${some word}</span>

Then, I want to parse the view before render and replace 'some world' with localized value. Ofcourse this can be done by other ways, but i wonder if there is any way to get this work.

Was it helpful?

Solution

You can extend the razor view engine by inhereting from RazorViewEngine class, you can find an example of how to do that here

Also, check out Nancy.Viewengines.Razor which is a view engine built on top of Razor view engine, and has it's own syntax parser

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top