Passing a dynamic object without a property that template is expecting gives the following error : 'System.Dynamic.DynamicObject' does not contain a

Jan 25, 2012 at 2:25 PM

Passing a dynamic object without a property that template is expecting gives the following error : 'System.Dynamic.DynamicObject' does not contain a definition for 'PropertyName'.
Is there a way to have Razor disregard the properties that's not in the dynamic object?

Below is the example.

template = @"This is standard Email Template.
Name:@Model.FullName

<strong>By:@Model.Author.</strong>
@Model.PropertyName"

Parse Method:
Razor.Parse(template, new { FullName="F - name", Author="author.." })

Coordinator
Feb 1, 2012 at 4:08 PM

I'm making changes to both the ViewBag property, and also the RazorDynamicObject we currently provide for dynamic support. Can you move your issue over to https://github.com/Antaris/RazorEngine and I'll make sure it gets looked at before the final v3 release...