Using the Razor view engine in a different way

Viewed 7701

I thought it would be interesting if I could use the new MVC Razor View engine as a mail merge technology. It can still be part of an MVC website and does not have to be stand-alone console app.

Example:

string  myTemplate = "Hello @Name,  How are you today?";
ViewModel.Name = "Billy Boy";
string output = RazorViewEngineRender( myTemplate, ViewModel );

Then the string output = "Hello Billy Boy, How are you today?"

The main thing is I want the template to be driven from a string rather than a view or partialview.

Does anyone know if this is possible ?

UPDATE:

Ben and Matt made a project on codeplex: http://razorengine.codeplex.com/

2 Answers
Related