Is there any way to list leftover substitution placeholders?

Sep 27, 2012 at 5:10 PM


We are using RazorEngine to perform substitutions into HTML emails using dynamic objects via Razor.Parse(). However, I've noticed that any substitution placeholders without a corresponding property in the object are simply replaced by empty string. This is unacceptable as we need to know about any values that were missed by the substitution process so that we can decide weather to send the e-mail or not.

I need a means of validating that the template and the object align and that all placeholders present in the template have been replaced by an actual value from the object.



Oct 2, 2012 at 4:22 PM

Why not validate your model before injecting it into the template using RazorEngine?

Oct 2, 2012 at 4:31 PM

Because I am using dynamic objects populated from JSON for my model. The entire reason I am using the RazorEngine is so that I don't need the MVC and all of it's accompanying overhead in my e-mail processor.

Oct 3, 2012 at 11:30 AM

Hi Evan,

Post your query on the Github site for RazorEngine:

I'm not sure I understand how you're handling your data on the server side, but these guys will know if you post some code it might help.