I use razor engine like this:
public class EmailService : IService
{
private readonly ITemplateService templateService;
public EmailService(ITemplat
It looks like someone else solved it for you.
https://github.com/aqueduct/Appia/blob/master/src/Aqueduct.Appia.Razor/RazorViewEngine.cs
The code you want is in the second ExecuteView method. Though they're creating their own view engine, you can instead create your own custom templating solution and use something similar. Basically they are looking for the Layout property of the Template, and if it exists doing a search and replace for the content from the layout.
Here is a link to RazorEngine's custom templating:
http://razorengine.codeplex.com/wikipage?title=Building%20Custom%20Base%20Templates&referringTitle=Documentation
Here is where I found your solution:
.NET Razor engine - Implementing layouts