Ejemplo n.º 1
0
        /// <inheritdoc />
        public override RazorParser DecorateRazorParser([NotNull] RazorParser razorParser, string sourceFileName)
        {
            sourceFileName = _pathNormalizer.NormalizePath(sourceFileName);

            var inheritedCodeTrees = ChunkInheritanceUtility.GetInheritedCodeTrees(sourceFileName);

            return(new MvcRazorParser(razorParser, inheritedCodeTrees, DefaultInheritedChunks));
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Locates and parses _ViewImports.cshtml files applying to the given <paramref name="sourceFileName"/> to
        /// create <see cref="ChunkTreeResult"/>s.
        /// </summary>
        /// <param name="sourceFileName">The path to a Razor file to locate _ViewImports.cshtml for.</param>
        /// <returns>Inherited <see cref="ChunkTreeResult"/>s.</returns>
        public IReadOnlyList <ChunkTreeResult> GetInheritedChunkTreeResults(string sourceFileName)
        {
            if (sourceFileName == null)
            {
                throw new ArgumentNullException(nameof(sourceFileName));
            }

            // Need the normalized path to resolve inherited chunks only. Full paths are needed for generated Razor
            // files checksum and line pragmas to enable DesignTime debugging.
            var normalizedPath = _pathNormalizer.NormalizePath(sourceFileName);

            return(ChunkInheritanceUtility.GetInheritedChunkTreeResults(normalizedPath));
        }