Пример #1
0
        // Internal since RazorEngine APIs are going to be obsolete.
        internal static RazorEngine CreateCore(RazorConfiguration configuration, bool designTime, Action <IRazorEngineBuilder> configure)
        {
            if (configuration == null)
            {
                throw new ArgumentNullException(nameof(configuration));
            }

            var builder = new DefaultRazorEngineBuilder(designTime);

            AddDefaults(builder);

            if (designTime)
            {
                AddDefaultDesignTimeFeatures(configuration, builder.Features);
            }
            else
            {
                AddDefaultRuntimeFeatures(configuration, builder.Features);
            }

            configure?.Invoke(builder);
            return(builder.Build());
        }
Пример #2
0
#pragma warning disable CS0618 // Type or member is obsolete
        private static RazorEngine CreateCore(RazorConfiguration configuration, bool designTime, Action <IRazorEngineBuilder> configure)
#pragma warning restore CS0618 // Type or member is obsolete
        {
            if (configuration == null)
            {
                throw new ArgumentNullException(nameof(configuration));
            }

            var builder = new DefaultRazorEngineBuilder(designTime);

            AddDefaults(builder);

            if (designTime)
            {
                AddDefaultDesignTimeFeatures(configuration, builder.Features);
            }
            else
            {
                AddDefaultRuntimeFeatures(configuration, builder.Features);
            }

            configure?.Invoke(builder);
            return(builder.Build());
        }