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.

Était-ce utile?

La 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

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top