예제 #1
0
 public TagHelperDirectiveSpanVisitor(
     [NotNull] ITagHelperDescriptorResolver descriptorResolver,
     [NotNull] ErrorSink errorSink)
 {
     _descriptorResolver = descriptorResolver;
     _errorSink = errorSink;
 }
예제 #2
0
 /// <summary>
 /// Initializes a new instance of <see cref="RazorParser"/>.
 /// </summary>
 /// <param name="codeParser">The <see cref="ParserBase"/> used for parsing code content.</param>
 /// <param name="markupParser">The <see cref="ParserBase"/> used for parsing markup content.</param>
 /// <param name="tagHelperDescriptorResolver">The <see cref="ITagHelperDescriptorResolver"/> used to resolve
 /// <see cref="TagHelperDescriptor"/>s.</param>
 public RazorParser([NotNull] ParserBase codeParser,
                    [NotNull] ParserBase markupParser,
                    ITagHelperDescriptorResolver tagHelperDescriptorResolver)
     : this(codeParser,
           markupParser,
           tagHelperDescriptorResolver,
           GetDefaultRewriters(markupParser))
 {
 }
예제 #3
0
 private RazorParser(ParserBase codeParser,
                     ParserBase markupParser,
                     ITagHelperDescriptorResolver tagHelperDescriptorResolver,
                     IEnumerable<ISyntaxTreeRewriter> optimizers)
 {
     CodeParser = codeParser;
     MarkupParser = markupParser;
     TagHelperDescriptorResolver = tagHelperDescriptorResolver;
     Optimizers = optimizers.ToList();
 }
예제 #4
0
        /// <summary>
        /// Initializes a new instance of <see cref="MvcRazorHost"/> using the specified <paramref name="chunkTreeCache"/>.
        /// </summary>
        /// <param name="chunkTreeCache">An <see cref="IChunkTreeCache"/> rooted at the application base path.</param>
        /// <param name="resolver">The <see cref="ITagHelperDescriptorResolver"/> used to resolve tag helpers on razor views.</param>
        public ShapeRazorHost(IChunkTreeCache chunkTreeCache, IHttpContextAccessor httpContextAccessor, ITagHelperDescriptorResolver resolver)
            : base(chunkTreeCache, resolver)
        {
            // We need to resolve the services using the scoped service provider
            // explicitly as IRazorViewEngine which is resolving IMvcRazorHost is
            // itself coming from the root service provider.

            // It's fine in this context as the TagHelperMvcRazorHost registration is Transient
            // which means we are not keeping any reference on IShapeTableManager and IThemeManager
            TagHelperDescriptorResolver = new ShapeTagHelperDescriptorResolver(
                new TagHelperTypeResolver(),
                new TagHelperDescriptorFactory(designTime: false),
                httpContextAccessor
            );
        }
        public TagHelperDirectiveSpanVisitor(
            ITagHelperDescriptorResolver descriptorResolver,
            ErrorSink errorSink)
        {
            if (descriptorResolver == null)
            {
                throw new ArgumentNullException(nameof(descriptorResolver));
            }

            if (errorSink == null)
            {
                throw new ArgumentNullException(nameof(errorSink));
            }

            _descriptorResolver = descriptorResolver;
            _errorSink = errorSink;
        }
예제 #6
0
        /// <summary>
        /// Initializes a new instance of <see cref="RazorParser"/>.
        /// </summary>
        /// <param name="codeParser">The <see cref="ParserBase"/> used for parsing code content.</param>
        /// <param name="markupParser">The <see cref="ParserBase"/> used for parsing markup content.</param>
        /// <param name="tagHelperDescriptorResolver">The <see cref="ITagHelperDescriptorResolver"/> used to resolve
        /// <see cref="TagHelperDescriptor"/>s.</param>
        public RazorParser(ParserBase codeParser,
                           ParserBase markupParser,
                           ITagHelperDescriptorResolver tagHelperDescriptorResolver)
            : this(codeParser,
                  markupParser,
                  tagHelperDescriptorResolver,
                  GetDefaultRewriters(markupParser))
        {
            if (codeParser == null)
            {
                throw new ArgumentNullException(nameof(codeParser));
            }

            if (markupParser == null)
            {
                throw new ArgumentNullException(nameof(markupParser));
            }
        }
예제 #7
0
 public GlobalImportTagHelperDirectiveSpanVisitor(
     ITagHelperDescriptorResolver descriptorResolver,
     IEnumerable<TagHelperDirectiveDescriptor> globalImportDirectiveDescriptors,
     ParserErrorSink errorSink)
     : base(descriptorResolver, errorSink)
 {
     _globalImportDirectiveDescriptors = globalImportDirectiveDescriptors;
 }
 public PreMinifyingMvcRazorHost(IChunkTreeCache chunkTreeCache, ITagHelperDescriptorResolver descriptorResolver)
 {
     _host = new MvcRazorHost(chunkTreeCache, descriptorResolver);
 }
예제 #9
0
 // Internal for testing use
 internal TagHelperDirectiveSpanVisitor(ITagHelperDescriptorResolver descriptorResolver)
     : this(descriptorResolver, new ErrorSink())
 {
 }
예제 #10
0
 public ViewImportsTagHelperDirectiveSpanVisitor(
     ITagHelperDescriptorResolver descriptorResolver,
     IEnumerable<TagHelperDirectiveDescriptor> viewImportsDirectiveDescriptors,
     ErrorSink errorSink)
     : base(descriptorResolver, errorSink)
 {
     _viewImportsDirectiveDescriptors = viewImportsDirectiveDescriptors;
 }
예제 #11
0
파일: MvcRazorHost.cs 프로젝트: ymd1223/Mvc
 /// <summary>
 /// Initializes a new instance of <see cref="MvcRazorHost"/> using the specified <paramref name="chunkTreeCache"/>.
 /// </summary>
 /// <param name="chunkTreeCache">An <see cref="IChunkTreeCache"/> rooted at the application base path.</param>
 /// <param name="resolver">The <see cref="ITagHelperDescriptorResolver"/> used to resolve tag helpers on razor views.</param>
 public MvcRazorHost(IChunkTreeCache chunkTreeCache, ITagHelperDescriptorResolver resolver)
     : this(chunkTreeCache, new RazorPathNormalizer())
 {
     TagHelperDescriptorResolver = resolver;
 }
예제 #12
0
 public TagHelperFeature(ITagHelperDescriptorResolver resolver)
 {
     Resolver = resolver;
 }
예제 #13
0
        public RazorHost(NamespaceCollection namespaces, IChunkTreeCache chunkTreeCache, ITagHelperDescriptorResolver resolver, IBasePageTypeProvider basePageTypeProvider)
            : base(chunkTreeCache, resolver)
        {
            // Remove the backtick from generic class names
            string baseClassName = basePageTypeProvider.BasePageType.FullName;
            int    tickIndex     = baseClassName.IndexOf('`');

            if (tickIndex > 0)
            {
                baseClassName = baseClassName.Substring(0, tickIndex);
            }

            DefaultBaseClass = basePageTypeProvider.BasePageType.IsGenericTypeDefinition ? $"{baseClassName}<{ChunkHelper.TModelToken}>" : baseClassName;
            DefaultInheritedChunks.OfType <SetBaseTypeChunk>().First().TypeName = DefaultBaseClass;  // The chunk is actually what injects the base name into the view
            EnableInstrumentation = false;

            // Add additional default namespaces from the execution context
            foreach (string ns in namespaces)
            {
                NamespaceImports.Add(ns);
            }
        }
예제 #14
0
 // Internal for testing use
 internal TagHelperDirectiveSpanVisitor(ITagHelperDescriptorResolver descriptorResolver)
     : this(descriptorResolver, new ErrorSink())
 {
 }
예제 #15
0
 /// <summary>
 /// Initializes a new instance of <see cref="MvcRazorHost"/> using the specified <paramref name="chunkTreeCache"/>.
 /// </summary>
 /// <param name="chunkTreeCache">An <see cref="IChunkTreeCache"/> rooted at the application base path.</param>
 /// <param name="resolver">The <see cref="ITagHelperDescriptorResolver"/> used to resolve tag helpers on razor views.</param>
 public MvcRazorHost(IChunkTreeCache chunkTreeCache, ITagHelperDescriptorResolver resolver)
     : base(chunkTreeCache, resolver)
 {
 }