/// <summary> /// Constructs a new RazorTemplateEngine with the specified host /// </summary> /// <param name="host">The host which defines the environment in which the generated template code will live</param> public RazorTemplateEngine(RazorEngineHost host) { if (host == null) { throw new ArgumentNullException("host"); } Host = host; }
/// <summary> /// Constructs the editor parser. One instance should be used per active editor. This /// instance _can_ be shared among reparses, but should _never_ be shared between documents. /// </summary> /// <param name="host">The <see cref="RazorEngineHost"/> which defines the environment in which the generated code will live. <see cref="F:RazorEngineHost.DesignTimeMode"/> should be set if design-time code mappings are desired</param> /// <param name="sourceFileName">The physical path to use in line pragmas</param> public RazorEditorParser(RazorEngineHost host, string sourceFileName) { if (host == null) { throw new ArgumentNullException("host"); } if (String.IsNullOrEmpty(sourceFileName)) { throw new ArgumentException(CommonResources.Argument_Cannot_Be_Null_Or_Empty, "sourceFileName"); } Host = host; FileName = sourceFileName; _parser = new BackgroundParser(host, sourceFileName); _parser.ResultsReady += (sender, args) => OnDocumentParseComplete(args); _parser.Start(); }
/// <summary> /// Constructs a new instance of the code generator for this language with the specified settings /// </summary> public override RazorCodeGenerator CreateCodeGenerator(string className, string rootNamespaceName, string sourceFileName, RazorEngineHost host) { return new CSharpRazorCodeGenerator(className, rootNamespaceName, sourceFileName, host); }
/// <summary> /// Constructs the code generator. Must return a new instance on EVERY call to ensure thread-safety /// </summary> public abstract RazorCodeGenerator CreateCodeGenerator(string className, string rootNamespaceName, string sourceFileName, RazorEngineHost host);