public static void Register(RazorProjectEngineBuilder builder) { if (builder == null) { throw new ArgumentNullException(nameof(builder)); } InjectDirective.Register(builder); ModelDirective.Register(builder); NamespaceDirective.Register(builder); PageDirective.Register(builder); FunctionsDirective.Register(builder); InheritsDirective.Register(builder); SectionDirective.Register(builder); builder.Features.Add(new DefaultTagHelperDescriptorProvider()); builder.Features.Add(new ViewComponentTagHelperDescriptorProvider()); builder.AddTargetExtension(new ViewComponentTagHelperTargetExtension()); builder.AddTargetExtension(new TemplateTargetExtension() { TemplateTypeName = "global::Microsoft.AspNetCore.Mvc.Razor.HelperResult", }); builder.Features.Add(new ModelExpressionPass()); builder.Features.Add(new PagesPropertyInjectionPass()); builder.Features.Add(new ViewComponentTagHelperPass()); builder.Features.Add(new RazorPageDocumentClassifierPass()); builder.Features.Add(new MvcViewDocumentClassifierPass()); builder.Features.Add(new AssemblyAttributeInjectionPass()); builder.Features.Add(new InstrumentationPass()); builder.SetImportFeature(new MvcImportProjectFeature()); }
public static void Register(IRazorEngineBuilder builder) { InjectDirective.Register(builder); ModelDirective.Register(builder); NamespaceDirective.Register(builder); PageDirective.Register(builder); FunctionsDirective.Register(builder); InheritsDirective.Register(builder); SectionDirective.Register(builder); builder.AddTargetExtension(new TemplateTargetExtension() { TemplateTypeName = "global::Microsoft.AspNetCore.Mvc.Razor.HelperResult", }); builder.Features.Add(new ModelExpressionPass()); builder.Features.Add(new PagesPropertyInjectionPass()); builder.Features.Add(new ViewComponentTagHelperPass()); builder.Features.Add(new RazorPageDocumentClassifierPass()); builder.Features.Add(new MvcViewDocumentClassifierPass()); builder.Features.Add(new AssemblyAttributeInjectionPass()); if (!builder.DesignTime) { builder.Features.Add(new InstrumentationPass()); } }