示例#1
0
        private static void AddComponentFeatures(RazorProjectEngineBuilder builder)
        {
            // Project Engine Features
            builder.Features.Add(new ComponentImportProjectFeature());

            // Directives (conditional on file kind)
            ComponentInjectDirective.Register(builder);
            ComponentLayoutDirective.Register(builder);
            ComponentPageDirective.Register(builder);
            ComponentTypeParamDirective.Register(builder);

            // Document Classifier
            builder.Features.Add(new ComponentDocumentClassifierPass());

            // Directive Classifier
            builder.Features.Add(new ComponentWhitespacePass());

            // Optimization
            builder.Features.Add(new ComponentComplexAttributeContentPass());
            builder.Features.Add(new ComponentLoweringPass());
            builder.Features.Add(new ComponentScriptTagPass());
            builder.Features.Add(new ComponentEventHandlerLoweringPass());
            builder.Features.Add(new ComponentReferenceCaptureLoweringPass());
            builder.Features.Add(new ComponentBindLoweringPass());
            builder.Features.Add(new ComponentTemplateDiagnosticPass());
            builder.Features.Add(new ComponentGenericTypePass());
            builder.Features.Add(new ComponentChildContentDiagnosticPass());
            builder.Features.Add(new ComponentMarkupBlockPass());
            builder.Features.Add(new ComponentMarkupEncodingPass());
        }
示例#2
0
    private static void AddComponentFeatures(RazorProjectEngineBuilder builder, RazorLanguageVersion razorLanguageVersion)
    {
        // Project Engine Features
        builder.Features.Add(new ComponentImportProjectFeature());

        // Directives (conditional on file kind)
        ComponentCodeDirective.Register(builder);
        ComponentInjectDirective.Register(builder);
        ComponentLayoutDirective.Register(builder);
        ComponentPageDirective.Register(builder);



        if (razorLanguageVersion.CompareTo(RazorLanguageVersion.Version_6_0) >= 0)
        {
            ComponentConstrainedTypeParamDirective.Register(builder);
        }
        else
        {
            ComponentTypeParamDirective.Register(builder);
        }

        if (razorLanguageVersion.CompareTo(RazorLanguageVersion.Version_5_0) >= 0)
        {
            ComponentPreserveWhitespaceDirective.Register(builder);
        }

        // Document Classifier
        builder.Features.Add(new ComponentDocumentClassifierPass());

        // Directive Classifier
        builder.Features.Add(new ComponentWhitespacePass());

        // Optimization
        builder.Features.Add(new ComponentComplexAttributeContentPass());
        builder.Features.Add(new ComponentLoweringPass());
        builder.Features.Add(new ComponentScriptTagPass());
        builder.Features.Add(new ComponentEventHandlerLoweringPass());
        builder.Features.Add(new ComponentKeyLoweringPass());
        builder.Features.Add(new ComponentReferenceCaptureLoweringPass());
        builder.Features.Add(new ComponentSplatLoweringPass());
        builder.Features.Add(new ComponentBindLoweringPass());
        builder.Features.Add(new ComponentCssScopePass());
        builder.Features.Add(new ComponentTemplateDiagnosticPass());
        builder.Features.Add(new ComponentGenericTypePass());
        builder.Features.Add(new ComponentChildContentDiagnosticPass());
        builder.Features.Add(new ComponentMarkupDiagnosticPass());
        builder.Features.Add(new ComponentMarkupBlockPass());
        builder.Features.Add(new ComponentMarkupEncodingPass());
    }