Exemplo n.º 1
0
        public string Run(object model)
        {
            if (model.IsAnonymous())
            {
                model = new AnonymousTypeWrapper(model);
            }

            RazorEngineTemplateBase instance = (RazorEngineTemplateBase)Activator.CreateInstance(this.templateType);

            instance.Model = model;
            instance.ExecuteAsync().Wait();
            return(instance.Result());
        }
        public async Task <string> RunAsync(object model = null)
        {
            if (model != null && model.IsAnonymous())
            {
                model = new AnonymousTypeWrapper(model);
            }

            RazorEngineTemplateBase instance = (RazorEngineTemplateBase)Activator.CreateInstance(this.templateType);

            instance.Model = model;

            await instance.ExecuteAsync();

            return(instance.Result());
        }