Exemplo n.º 1
0
        public TemplateServiceConfiguration()
        {
            Activator = new DefaultActivator();
            CompilerServiceFactory =
#if RAZOR4
                new Roslyn.RoslynCompilerServiceFactory();
#else
                new DefaultCompilerServiceFactory();
#endif
            EncodedStringFactory = new HtmlEncodedStringFactory();

#if !RAZOR4
#pragma warning disable 0618 // Backwards Compat.
            CodeInspectors = new List <ICodeInspector>();
#pragma warning restore 0618 // Backwards Compat.
#endif

            ReferenceResolver = new UseCurrentAssembliesReferenceResolver();
            CachingProvider   = new DefaultCachingProvider();
            TemplateManager   =
                new DelegateTemplateManager();

            Namespaces = new HashSet <string>
            {
                "System",
                "System.Collections.Generic",
                "System.Linq"
            };

            var config = RazorEngineConfigurationSection.GetConfiguration();
            Language = (config == null)
                           ? Language.CSharp
                           : config.DefaultLanguage;
        }
        public TemplateServiceConfiguration()
        {
            Activator = new DefaultActivator();
            CompilerServiceFactory =
                new Roslyn.RoslynCompilerServiceFactory();

            EncodedStringFactory = new HtmlEncodedStringFactory();



            ReferenceResolver = new UseCurrentAssembliesReferenceResolver();
            CachingProvider   = new DefaultCachingProvider();
            TemplateManager   =
                new DelegateTemplateManager();

            Namespaces = new HashSet <string>
            {
                "System",
                "System.Collections.Generic",
                "System.Linq"
            };
            Language = Language.CSharp;
        }