public GeneratorResults GenerateCode(ViewDescriptor<IRazorTemplate> descriptor, string className, RazorEngineHost host) { var engine = new RazorTemplateEngine(host); GeneratorResults results; using (var fileStream = new FileStream(descriptor.Template.FilePath, FileMode.Open, FileAccess.Read)) using (var reader = new StreamReader(fileStream)) { results = engine.GenerateCode(reader, className, host.DefaultNamespace, descriptor.ViewPath); } if (!results.Success) { throw CreateExceptionFromParserError(results.ParserErrors.Last(), descriptor.Name()); } return results; }
public GeneratorResults GenerateCode(ViewDescriptor <IRazorTemplate> descriptor, string className, RazorEngineHost host) { var engine = new RazorTemplateEngine(host); GeneratorResults results; using (var fileStream = new FileStream(descriptor.Template.FilePath, FileMode.Open, FileAccess.Read)) using (var reader = new StreamReader(fileStream)) { results = engine.GenerateCode(reader, className, host.DefaultNamespace, descriptor.ViewPath); } if (!results.Success) { throw CreateExceptionFromParserError(results.ParserErrors.Last(), descriptor.Name()); } return(results); }
public string Name() { return(_descriptor.Name()); }