Search code examples
asp.netrazorengine

RazorEngine 3.6.3 cannot convert from 'string' to 'RazorEngine.Templating.ITemplateKey


I have a problem with RazorEngine version 3.6.3 RazorEngine cannot convert from 'string' to 'RazorEngine.Templating.ITemplateKey

My code is below:

        var templateServiceConfiguration = new TemplateServiceConfiguration();
        templateServiceConfiguration.Namespaces.Add("System.Configuration");

        var body = string.Empty;

        using (var service = RazorEngineService.Create(templateServiceConfiguration))
        {
            body = service.RunCompile(emailTemplate.Body, emailTemplate.UniqueName, model: _model, modelType: null, viewBag: null);
        }

So this method service.RunCompile( what as first parameter ITemplateKey, but there also overloads of this method that must support my version.

Please, help.


Solution

  • Solved using this RazorEngineServiceExtensions.RunCompile(service, emailTemplate.Body, emailTemplate.UniqueName, modelType: null, model: _model);