System.Dynamic.DynamicObject does not contain a definition for 'PropertyName'.

Nov 3, 2011 at 8:26 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.." })