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); if (virtualPath.StartsWith("~/App_Code", StringComparison.OrdinalIgnoreCase)) { // change to app-code // Under App_Code => It's a Web Code file return new WebCodeRazorHost(virtualPath, physicalPath); } 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(); } WebPageRazorHost host = (factory ?? new WebRazorHostFactory()).CreateHost(virtualPath, physicalPath); if (config != null && config.Pages != null) { ApplyConfigurationToHost(config.Pages, host); } return host; }
public static WebPageRazorHost CreateHostFromConfig(RazorWebSectionGroup config, string virtualPath, string physicalPath) { if (config == null) { throw new ArgumentNullException("config"); } if (String.IsNullOrEmpty(virtualPath)) { throw new ArgumentException(String.Format("CommonResources.Argument_Cannot_Be_Null_Or_Empty {0}", "virtualPath"), "virtualPath"); } return CreateHostFromConfigCore(config, virtualPath, physicalPath); }
internal static WebPageRazorHost CreateHostFromConfigCore(RazorWebSectionGroup config, string virtualPath) { return CreateHostFromConfigCore(config, virtualPath, null); }
public static WebPageRazorHost CreateHostFromConfig(RazorWebSectionGroup config, string virtualPath) { return CreateHostFromConfig(config, virtualPath, null); }