Is there any way to list leftover substitution placeholders?

Sep 27, 2012 at 4:10 PM

Hello,

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.

Thanks,

Evan

Oct 2, 2012 at 3:22 PM

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

http://weblogs.asp.net/scottgu/archive/2010/01/15/asp-net-mvc-2-model-validation.aspx

Oct 2, 2012 at 3: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 10:30 AM

Hi Evan,

Post your query on the Github site for RazorEngine: https://github.com/Antaris/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.

 

Mark