internal static WebPageRazorHost CreateHostFromConfigCore(RazorWebSectionGroup config, string virtualPath, string physicalPath)
        {
            // Use the virtual path to select a host environment for the generated code
            // Do this check here because the App_Code host can't be overridden.

            // Make the path app relative
            virtualPath = EnsureAppRelative(virtualPath);

            WebPageRazorHost host;
            if (virtualPath.StartsWith("~/App_Code", StringComparison.OrdinalIgnoreCase))
            {
                // Under App_Code => It's a Web Code file
                host = new WebCodeRazorHost(virtualPath, physicalPath);
            }
            else
            {
                WebRazorHostFactory factory = null;
                if (config != null && config.Host != null && !String.IsNullOrEmpty(config.Host.FactoryType))
                {
                    Func<WebRazorHostFactory> factoryCreator = _factories.GetOrAdd(config.Host.FactoryType, CreateFactory);
                    Debug.Assert(factoryCreator != null); // CreateFactory should throw if there's an error creating the factory
                    factory = factoryCreator();
                }

                host = (factory ?? new WebRazorHostFactory()).CreateHost(virtualPath, physicalPath);

                if (config != null && config.Pages != null)
                {
                    ApplyConfigurationToHost(config.Pages, host);
                }
            }

            return host;
        }
        internal static WebPageRazorHost CreateHostFromConfigCore(RazorWebSectionGroup config, string virtualPath, string physicalPath)
        {
            // Use the virtual path to select a host environment for the generated code
            // Do this check here because the App_Code host can't be overridden.

            // Make the path app relative
            virtualPath = EnsureAppRelative(virtualPath);

            WebPageRazorHost host;

            if (virtualPath.StartsWith("~/App_Code", StringComparison.OrdinalIgnoreCase))
            {
                // Under App_Code => It's a Web Code file
                host = new WebCodeRazorHost(virtualPath, physicalPath);
            }
            else
            {
                WebRazorHostFactory factory = null;
                if (config != null && config.Host != null && !String.IsNullOrEmpty(config.Host.FactoryType))
                {
                    Func <WebRazorHostFactory> factoryCreator = _factories.GetOrAdd(config.Host.FactoryType, CreateFactory);
                    Debug.Assert(factoryCreator != null); // CreateFactory should throw if there's an error creating the factory
                    factory = factoryCreator();
                }

                host = (factory ?? new WebRazorHostFactory()).CreateHost(virtualPath, physicalPath);

                if (config != null && config.Pages != null)
                {
                    ApplyConfigurationToHost(config.Pages, host);
                }
            }

            return(host);
        }