internal MvcRazorHost(ICodeTreeCache codeTreeCache, RazorPathNormalizer pathNormalizer) : base(new CSharpRazorCodeLanguage()) { _pathNormalizer = pathNormalizer; _baseType = BaseType; _codeTreeCache = codeTreeCache; TagHelperDescriptorResolver = new TagHelperDescriptorResolver(); DefaultBaseClass = BaseType + "<" + DefaultModel + ">"; DefaultNamespace = "Asp"; // Enable instrumentation by default to allow precompiled views to work with BrowserLink. EnableInstrumentation = true; GeneratedClassContext = new GeneratedClassContext( executeMethodName: "ExecuteAsync", writeMethodName: "Write", writeLiteralMethodName: "WriteLiteral", writeToMethodName: "WriteTo", writeLiteralToMethodName: "WriteLiteralTo", templateTypeName: "Microsoft.AspNet.Mvc.Razor.HelperResult", defineSectionMethodName: "DefineSection", generatedTagHelperContext: new GeneratedTagHelperContext { ExecutionContextTypeName = typeof(TagHelperExecutionContext).FullName, ExecutionContextAddMethodName = nameof(TagHelperExecutionContext.Add), ExecutionContextAddTagHelperAttributeMethodName = nameof(TagHelperExecutionContext.AddTagHelperAttribute), ExecutionContextAddHtmlAttributeMethodName = nameof(TagHelperExecutionContext.AddHtmlAttribute), ExecutionContextOutputPropertyName = nameof(TagHelperExecutionContext.Output), RunnerTypeName = typeof(TagHelperRunner).FullName, RunnerRunAsyncMethodName = nameof(TagHelperRunner.RunAsync), ScopeManagerTypeName = typeof(TagHelperScopeManager).FullName, ScopeManagerBeginMethodName = nameof(TagHelperScopeManager.Begin), ScopeManagerEndMethodName = nameof(TagHelperScopeManager.End), TagHelperContentTypeName = nameof(TagHelperContent), // Can't use nameof because RazorPage is not accessible here. CreateTagHelperMethodName = "CreateTagHelper", StartTagHelperWritingScopeMethodName = "StartTagHelperWritingScope", EndTagHelperWritingScopeMethodName = "EndTagHelperWritingScope", WriteTagHelperAsyncMethodName = "WriteTagHelperAsync", WriteTagHelperToAsyncMethodName = "WriteTagHelperToAsync", // Can't use nameof because IHtmlHelper is (also) not accessible here. MarkAsHtmlEncodedMethodName = HtmlHelperPropertyName + ".Raw", }) { ResolveUrlMethodName = "Href", BeginContextMethodName = "BeginContext", EndContextMethodName = "EndContext" }; foreach (var ns in _defaultNamespaces) { NamespaceImports.Add(ns); } }
/// <summary> /// Initializes a new instance of <see cref="ChunkInheritanceUtility"/>. /// </summary> /// <param name="razorHost">The <see cref="MvcRazorHost"/> used to parse <c>_ViewImports</c> pages.</param> /// <param name="codeTreeCache"><see cref="ICodeTreeCache"/> that caches <see cref="CodeTree"/> instances. /// </param> /// <param name="defaultInheritedChunks">Sequence of <see cref="Chunk"/>s inherited by default.</param> public ChunkInheritanceUtility([NotNull] MvcRazorHost razorHost, [NotNull] ICodeTreeCache codeTreeCache, [NotNull] IReadOnlyList <Chunk> defaultInheritedChunks) { _razorHost = razorHost; _defaultInheritedChunks = defaultInheritedChunks; _codeTreeCache = codeTreeCache; }
/// <summary> /// Initializes a new instance of <see cref="ChunkInheritanceUtility"/>. /// </summary> /// <param name="razorHost">The <see cref="MvcRazorHost"/> used to parse <c>_GlobalImport</c> pages.</param> /// <param name="codeTreeCache"><see cref="ICodeTreeCache"/> that caches <see cref="CodeTree"/> instances. /// </param> /// <param name="defaultInheritedChunks">Sequence of <see cref="Chunk"/>s inherited by default.</param> public ChunkInheritanceUtility([NotNull] MvcRazorHost razorHost, [NotNull] ICodeTreeCache codeTreeCache, [NotNull] IReadOnlyList<Chunk> defaultInheritedChunks) { _razorHost = razorHost; _defaultInheritedChunks = defaultInheritedChunks; _codeTreeCache = codeTreeCache; }
/// <summary> /// Initializes a new instance of <see cref="MvcRazorHost"/> using the specified <paramref name="codeTreeCache"/>. /// </summary> /// <param name="codeTreeCache">An <see cref="ICodeTreeCache"/> rooted at the application base path.</param> public MvcRazorHost(ICodeTreeCache codeTreeCache) : this(codeTreeCache, new RazorPathNormalizer()) { }
public TestMvcRazorHost(ICodeTreeCache codeTreeCache) : base(codeTreeCache) { }