title: TemplateCompilationError with RazorEngine and Layouts
body: <p>I've been trying to use RazorEngine in a little project of mine but can't get past this error when I try to use template layouts. </p>
  
  <blockquote>
    <p>Unable to compile template. 'object' does not contain a definition for
    'Description' and no extension method 'Description' accepting a first
    argument of type 'object' could be found (are you missing a using
    directive or an assembly reference?)</p>
  </blockquote>
  
  <p><strong>My Setup:</strong>
  I have a template layout like this:</p>
  
  <pre><code>&lt;html&gt;
  &lt;head&gt;
      &lt;title&gt;@Model.Description&lt;/title&gt;
  &lt;/head&gt;
  &lt;body&gt;
      @RenderBody()
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>And then a page template that looks like this:</p>
  
  <pre><code>@{
      _Layout = "Layout.cshtml";
  }
  &lt;h1&gt;@Model.Description&lt;/h1&gt;
  </code></pre>
  
  <p>Here is a test Main function I'm using to try and figure this out:</p>
  
  <pre><code>    static void Main(string[] args)
      {
          // Configuration for RazorEngine
          var config = new TemplateServiceConfiguration
          {
              EncodedStringFactory = new RawStringFactory(),
  
              Resolver = new DelegateTemplateResolver(name =&gt;
              {
                  var file = name;
                  var content = File.ReadAllText("Templates/" + file);
                  return content;
              })
          };
  
          // Try to render output using Razor
          using (var service = new TemplateService(config))
          {
              string template = File.ReadAllText("Templates/Default.cshtml");
  
              dynamic model = new ExpandoObject();
              model.Description = "This is a test";
              string result = service.Parse(template, model);
              Console.WriteLine(result);
              if (Debugger.IsAttached)
              {
                  Console.ReadLine();
              }
  
          }
      }
  </code></pre>
  
  <p>Any idea what I'm missing? </p>
  
  <p>Update: It works if I replace the dynamic model object with a POCO with a Description property. I also tried the typed version of Parse with </p>
  
  <blockquote>
    <p>dynamic</p>
  </blockquote>
  
  <p>, <code>ExpandoObject</code>, and <code>IDictionary&lt;string, object&gt;</code> but they all have the same error.</p>
  
  <p><strong>Update:</strong>
  I found this project on Github that seems to make it work somehow:
  <a href="https://github.com/mikoskinen/graze/blob/master/src/core/Graze.cs#L174" rel="nofollow">https://github.com/mikoskinen/graze/blob/master/src/core/Graze.cs#L174</a></p>