title: Use multiple templates with separated viewmodel with RazorEngine
body: <p>I have created a template.cshtml which includes 2 partials header.cshtml and footer.cshtml.</p>
  
  <p>When it is rendered it looks like this:</p>
  
  <p><a href="https://i.stack.imgur.com/U6iTd.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/U6iTd.png" alt="enter image description here"></a></p>
  
  <pre><code>IRazorEngineService service = RazorEngine.Engine.Razor;
  
  string _webPath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "views");
  var config = new TemplateServiceConfiguration
  {
      //Use this template manager when loading from template files.  
      TemplateManager = new ResolvePathTemplateManager(new[] { _webPath })  
  };
  
  service = RazorEngineService.Create(config);
  ITemplateKey key = service.GetKey("template");
  
  service.Compile("header", typeof(HeaderViewModel));
  service.Compile("footer", typeof(FooterViewModel));
  
  var model = new ContentViewModel();
  model.Content = "This is the content";
  
  model.FooterViewModel = new FooterViewModel();
  model.HeaderViewModel = new HeaderViewModel();
  model.FooterViewModel.Footer = "footer";
  model.HeaderViewModel.Header = "header";
  
  var html =  service.RunCompile(key, model.GetType(), model);
  </code></pre>
  
  <p><strong>template.cshtml</strong></p>
  
  <pre><code>@model RazorMachineTest.ContentViewModel
  
  &lt;html&gt;
  &lt;body&gt;
         &lt;header&gt;
             @Include("header", @Model.HeaderViewModel, typeof(RazorMachineTest.HeaderViewModel))
         &lt;/header&gt;
  
         &lt;h1&gt;@Model.Content&lt;/h1&gt;
  
         &lt;footer&gt;
            @Include("footer", @Model.FooterViewModel, typeof(RazorMachineTest.FooterViewModel))
         &lt;/footer&gt;
  
  &lt;/body&gt;  
  &lt;/html&gt; 
  </code></pre>
  
  <p><strong>header.cshtml</strong></p>
  
  <pre><code>@using RazorEngine
  @using RazorMachineTest
  
  &lt;b&gt;I am inside the&lt;/b&gt;
  &lt;span&gt;@Model.Header&lt;/span&gt;
  </code></pre>
  
  <p><strong>footer.cshtml</strong></p>
  
  <pre><code>@using RazorEngine
  @using RazorMachineTest
  
  &lt;b&gt;I am inside the &lt;/b&gt;
  &lt;span&gt;@Model.Footer&lt;/span&gt;
  </code></pre>
  
  <p>What I do not like about the solution is that the viewmodels must be contained into each other.</p>
  
  <p>I would like to have a separation of each viewmodel, one should not know the other. The reason is that the content should not know a general header or footer or should not be the parent of a general header/footer.</p>
  
  <p>Because I want to re-use the template with many different 'Content' viewmodels.</p>
  
  <p>What exactly do I have to change to make this work basing on my existing code?</p>
  
  <p>Note: Don`t get confused if you read RazorMachine namespaces, that was for testing...</p>