RazorEngine макеты строк и разделы?

Я использую бритву, как это:

<code>public class EmailService : IService
{
    private readonly ITemplateService templateService;

    public EmailService(ITemplateService templateService)
    {
        if (templateService == null)
        {
            throw new ArgumentNullException("templateService");
        }
        this.templateService = templateService;
    }

    public string GetEmailTemplate(string templateName)
    {
        if (templateName == null)
        {
            throw new ArgumentNullException("templateName");
        }
        Assembly assembly = Assembly.GetAssembly(typeof(EmailTemplate));
        Stream stream = assembly.GetManifestResourceStream(typeof(EmailTemplate), "{0}.cshtml".FormatWith(templateName));
        string template = stream.ReadFully();
        return template;
    }

    public string GetEmailBody(string templateName, object model = null)
    {
        if (templateName == null)
        {
            throw new ArgumentNullException("templateName");
        }
        string template = GetEmailTemplate(templateName);
        string emailBody = templateService.Parse(template, model, null, null);
        return emailBody;
    }
}
</code>

Служба шаблонов, которую я использую, внедряется, хотя это просто реализация по умолчанию:

<code>    internal ITemplateService InstanceDefaultTemplateService()
    {
        ITemplateServiceConfiguration configuration = new TemplateServiceConfiguration();
        ITemplateService service = new TemplateService(configuration);
        return service;
    }
</code>

Так как в этом случае, в частности, я буду создавать электронные письма из этих шаблонов. Я хочу быть в состоянии использовать@sections для сообщения электронной почты, темы и различных разделов тела сообщения электронной почты, при этом используется макет, в котором я указываю стили, общие для всей структуры электронной почты (которая будет выглядеть как одна изMailChimpвероятно).

Вопрос тогда двоякий:

How can I specify layouts in RazorEngine? How can I specify these layouts from strings (or a stream)? since as you can see, I use embedded resources to store the razor email templates. Update

Может быть, я не был ясен, но я имею в видуRazorEngine библиотека.

Ответы на вопрос(3)

Ваш ответ на вопрос