Ejemplo n.º 1
0
        internal static void ExecuteStartPageInternal(
            HttpApplication application,
            Action <string> monitorFile,
            IVirtualPathFactory virtualPathFactory,
            IEnumerable <string> supportedExtensions
            )
        {
            ApplicationStartPage startPage = null;

            foreach (var extension in supportedExtensions)
            {
                var vpath = StartPageVirtualPath + extension;

                // We need to monitor regardless of existence because the user could add/remove the
                // file at any time.
                monitorFile(vpath);
                if (!virtualPathFactory.Exists(vpath))
                {
                    continue;
                }

                if (startPage == null)
                {
                    startPage                    = virtualPathFactory.CreateInstance <ApplicationStartPage>(vpath);
                    startPage.Application        = application;
                    startPage.VirtualPathFactory = virtualPathFactory;
                    startPage.ExecuteInternal();
                }
            }
        }
        internal static void ExecuteStartPageInternal(HttpApplication application, Action<string> monitorFile, IVirtualPathFactory virtualPathFactory, IEnumerable<string> supportedExtensions)
        {
            ApplicationStartPage startPage = null;

            foreach (var extension in supportedExtensions)
            {
                var vpath = StartPageVirtualPath + extension;

                // We need to monitor regardless of existence because the user could add/remove the
                // file at any time.
                monitorFile(vpath);
                if (!virtualPathFactory.Exists(vpath))
                {
                    continue;
                }

                if (startPage == null)
                {
                    startPage = virtualPathFactory.CreateInstance<ApplicationStartPage>(vpath);
                    startPage.Application = application;
                    startPage.VirtualPathFactory = virtualPathFactory;
                    startPage.ExecuteInternal();
                }
            }
        }
Ejemplo n.º 3
0
        internal static IHttpHandler CreateFromVirtualPath(
            string virtualPath,
            IVirtualPathFactory virtualPathFactory
            )
        {
            // We will try to create a WebPage from our factory. If this fails, we assume that the virtual path maps to an IHttpHandler.
            // Instantiate the page from the virtual path
            WebPage page = virtualPathFactory.CreateInstance <WebPage>(virtualPath);

            // If it's not a page, assume it's a regular handler
            if (page == null)
            {
                return(virtualPathFactory.CreateInstance <IHttpHandler>(virtualPath));
            }

            // Mark it as a 'top level' page (as opposed to a user control or master)
            page.TopLevelPage = true;

            // Give it its virtual path
            page.VirtualPath = virtualPath;

            // Assign it the object factory
            page.VirtualPathFactory = virtualPathFactory;

            // Return a handler over it
            return(new WebPageHttpHandler(page));
        }
        public TResource CreateInstance <TResource>(string virtualPath)
        {
            IVirtualPathFactory factory = _factories.FirstOrDefault(f => f.Exists(virtualPath));

            if (factory != null)
            {
                return((TResource)factory.CreateInstance(virtualPath));
            }

            return((TResource)_defaultFactory(virtualPath, typeof(TResource)));
        }
Ejemplo n.º 5
0
        internal static WebPageRenderingBase GetStartPage(
            WebPageRenderingBase page,
            IVirtualPathFactory virtualPathFactory,
            string appDomainAppVirtualPath,
            string fileName,
            IEnumerable <string> supportedExtensions
            )
        {
            // Build up a list of pages to execute, such as one of the following:
            // ~/somepage.cshtml
            // ~/_pageStart.cshtml --> ~/somepage.cshtml
            // ~/_pageStart.cshtml --> ~/sub/_pageStart.cshtml --> ~/sub/somepage.cshtml
            WebPageRenderingBase currentPage = page;
            var pageDirectory = VirtualPathUtility.GetDirectory(page.VirtualPath);

            // Start with the requested page's directory, find the init page,
            // and then traverse up the hierarchy to find init pages all the
            // way up to the root of the app.
            while (
                !String.IsNullOrEmpty(pageDirectory) &&
                pageDirectory != "/" &&
                PathUtil.IsWithinAppRoot(appDomainAppVirtualPath, pageDirectory)
                )
            {
                // Go through the list of supported extensions
                foreach (var extension in supportedExtensions)
                {
                    var virtualPath = VirtualPathUtility.Combine(
                        pageDirectory,
                        fileName + "." + extension
                        );

                    // Can we build a file from the current path?
                    if (virtualPathFactory.Exists(virtualPath))
                    {
                        var parentStartPage = virtualPathFactory.CreateInstance <StartPage>(
                            virtualPath
                            );
                        parentStartPage.VirtualPath        = virtualPath;
                        parentStartPage.ChildPage          = currentPage;
                        parentStartPage.VirtualPathFactory = virtualPathFactory;
                        currentPage = parentStartPage;
                        break;
                    }
                }

                pageDirectory = currentPage.GetDirectory(pageDirectory);
            }

            // At this point 'currentPage' is the root-most StartPage (if there were
            // any StartPages at all) or it is the requested page itself.
            return(currentPage);
        }
 internal static void ExecuteStartPage(HttpApplication application, Action<string> monitorFile, IVirtualPathFactory virtualPathFactory, IEnumerable<string> supportedExtensions)
 {
     try
     {
         ExecuteStartPageInternal(application, monitorFile, virtualPathFactory, supportedExtensions);
     }
     catch (Exception e)
     {
         // Throw it as a HttpException so as to
         // display the original stack trace information.
         Exception = e;
         throw new HttpException(null, e);
     }
 }
 public PrecompiledView(
     string virtualPath,
     Type type,
     bool runViewStartPages,
     IEnumerable <string> fileExtensions,
     IVirtualPathFactory virtualPathFactory,
     IViewPageActivator viewPageActivator)
 {
     this.type = type;
     this.virtualPathFactory = virtualPathFactory;
     this.virtualPath        = virtualPath;
     RunViewStartPages       = runViewStartPages;
     ViewStartFileExtensions = fileExtensions;
     this.viewPageActivator  = viewPageActivator;
 }
 public PrecompiledView(
     string virtualPath,
     Type type,
     bool runViewStartPages,
     IEnumerable<string> fileExtensions,
     IVirtualPathFactory virtualPathFactory,
     IViewPageActivator viewPageActivator)
 {
     this.type = type;
     this.virtualPathFactory = virtualPathFactory;
     this.virtualPath = virtualPath;
     RunViewStartPages = runViewStartPages;
     ViewStartFileExtensions = fileExtensions;
     this.viewPageActivator = viewPageActivator;
 }
Ejemplo n.º 9
0
        public static T CreateInstance <T>(this IVirtualPathFactory factory, string virtualPath) where T : class
        {
            var virtualPathFactoryManager = factory as VirtualPathFactoryManager;

            if (virtualPathFactoryManager != null)
            {
                return(virtualPathFactoryManager.CreateInstanceOfType <T>(virtualPath));
            }
            var buildManagerFactory = factory as BuildManagerWrapper;

            if (buildManagerFactory != null)
            {
                return(buildManagerFactory.CreateInstanceOfType <T>(virtualPath));
            }

            return(factory.CreateInstance(virtualPath) as T);
        }
Ejemplo n.º 10
0
        protected override void OnStartProvider()
        {
            var property = typeof(VirtualPathFactoryManager).GetProperty("Instance", BindingFlags.NonPublic | BindingFlags.Static);

            if (property != null)
            {
                var member = typeof(VirtualPathFactoryManager).GetField("_virtualPathFactories", BindingFlags.NonPublic | BindingFlags.Instance);
                if (member != null)
                {
                    var instance = (VirtualPathFactoryManager)property.GetValue(null);
                    var list     = (LinkedList <IVirtualPathFactory>)member.GetValue(instance);
                    var factory  = list.First.Value;
                    _previousPathFactory = factory;
                    VirtualPathFactoryManager.RegisterVirtualPathFactory(this);
                }
            }
        }
        internal static WebPageRenderingBase GetStartPage(WebPageRenderingBase page, IVirtualPathFactory virtualPathFactory, string appDomainAppVirtualPath,
                                                          string fileName, IEnumerable<string> supportedExtensions)
        {
            // Build up a list of pages to execute, such as one of the following:
            // ~/somepage.cshtml
            // ~/_pageStart.cshtml --> ~/somepage.cshtml
            // ~/_pageStart.cshtml --> ~/sub/_pageStart.cshtml --> ~/sub/somepage.cshtml
            WebPageRenderingBase currentPage = page;
            var pageDirectory = VirtualPathUtility.GetDirectory(page.VirtualPath);

            // Start with the requested page's directory, find the init page,
            // and then traverse up the hierarchy to find init pages all the
            // way up to the root of the app.
            while (!string.IsNullOrEmpty(pageDirectory))
            {
                // Go through the list of supported extensions
                foreach (var extension in supportedExtensions)
                {
                    var virtualPath = VirtualPathUtility.Combine(pageDirectory, fileName + "." + extension);

                    // Can we build a file from the current path?
                    if (virtualPathFactory.Exists(virtualPath))
                    {
                        var parentStartPage = virtualPathFactory.CreateInstance(virtualPath) as StartPage;
                        parentStartPage.VirtualPath = virtualPath;
                        parentStartPage.ChildPage = currentPage;
                        parentStartPage.VirtualPathFactory = virtualPathFactory;
                        currentPage = parentStartPage;
                        break;
                    }
                }
                
                pageDirectory = pageDirectory == "~/" 
                    ? null
                    : VirtualPathUtility.GetDirectory(pageDirectory);
            }

            // At this point 'currentPage' is the root-most StartPage (if there were
            // any StartPages at all) or it is the requested page itself.
            return currentPage;
        } 
Ejemplo n.º 12
0
        private static string GetRouteLevelMatch(string pathValue, IEnumerable<string> supportedExtensions, IVirtualPathFactory virtualPathFactory, HttpContextBase context, DisplayModeProvider displayModeProvider)
        {
            foreach (string supportedExtension in supportedExtensions)
            {
                string virtualPath = "~/" + pathValue;

                // Only add the extension if it's not already there
                if (!virtualPath.EndsWith("." + supportedExtension, StringComparison.OrdinalIgnoreCase))
                {
                    virtualPath += "." + supportedExtension;
                }
                DisplayInfo virtualPathDisplayInfo = displayModeProvider.GetDisplayInfoForVirtualPath(virtualPath, context, virtualPathFactory.Exists, currentDisplayMode: null);

                if (virtualPathDisplayInfo != null)
                {
                    // If there's an exact match on disk, return it unless it starts with an underscore
                    if (Path.GetFileName(virtualPathDisplayInfo.FilePath).StartsWith("_", StringComparison.OrdinalIgnoreCase))
                    {
                        throw new HttpException(404, WebPageResources.WebPageRoute_UnderscoreBlocked);
                    }

                    string resolvedVirtualPath = virtualPathDisplayInfo.FilePath;

                    // Matches are not expected to be virtual paths so remove the ~/ from the match
                    if (resolvedVirtualPath.StartsWith("~/", StringComparison.OrdinalIgnoreCase))
                    {
                        resolvedVirtualPath = resolvedVirtualPath.Remove(0, 2);
                    }

                    DisplayModeProvider.SetDisplayMode(context, virtualPathDisplayInfo.DisplayMode);

                    return resolvedVirtualPath;
                }
            }

            return null;
        }
Ejemplo n.º 13
0
 internal static void ExecuteStartPage(
     HttpApplication application,
     Action <string> monitorFile,
     IVirtualPathFactory virtualPathFactory,
     IEnumerable <string> supportedExtensions
     )
 {
     try
     {
         ExecuteStartPageInternal(
             application,
             monitorFile,
             virtualPathFactory,
             supportedExtensions
             );
     }
     catch (Exception e)
     {
         // Throw it as a HttpException so as to
         // display the original stack trace information.
         Exception = e;
         throw new HttpException(null, e);
     }
 }
Ejemplo n.º 14
0
        internal static WebPageBase CreateInstanceFromVirtualPath(
            string virtualPath,
            IVirtualPathFactory virtualPathFactory
            )
        {
            // Get the compiled object
            try
            {
                WebPageBase webPage = virtualPathFactory.CreateInstance <WebPageBase>(virtualPath);

                // Give it its virtual path
                webPage.VirtualPath = virtualPath;

                // Assign it the VirtualPathFactory
                webPage.VirtualPathFactory = virtualPathFactory;

                return(webPage);
            }
            catch (HttpException e)
            {
                BuildManagerExceptionUtil.ThrowIfUnsupportedExtension(virtualPath, e);
                throw;
            }
        }
Ejemplo n.º 15
0
        internal static IHttpHandler CreateFromVirtualPath(string virtualPath, IVirtualPathFactory virtualPathFactory)
        {
            // We will try to create a WebPage from our factory. If this fails, we assume that the virtual path maps to an IHttpHandler.
            // Instantiate the page from the virtual path
            WebPage page = virtualPathFactory.CreateInstance<WebPage>(virtualPath);

            // If it's not a page, assume it's a regular handler
            if (page == null)
            {
                return virtualPathFactory.CreateInstance<IHttpHandler>(virtualPath);
            }

            // Mark it as a 'top level' page (as opposed to a user control or master)
            page.TopLevelPage = true;

            // Give it its virtual path
            page.VirtualPath = virtualPath;

            // Assign it the object factory
            page.VirtualPathFactory = virtualPathFactory;

            // Return a handler over it
            return new WebPageHttpHandler(page);
        }
Ejemplo n.º 16
0
 internal void RegisterVirtualPathFactoryInternal(IVirtualPathFactory virtualPathFactory)
 {
     _virtualPathFactories.AddBefore(_virtualPathFactories.Last, virtualPathFactory);
 }
Ejemplo n.º 17
0
 public static void Start(MarkdownPagesOptions options, IVirtualPathFactory virtualPathFactory)
 {
     WebPageHttpHandlerExtensions.RegisterExtensions(options.MarkdownExtensions.Select(ext => ext.RemoveLeadingDot()));
     VirtualPathFactoryManager.RegisterVirtualPathFactory(virtualPathFactory);
 }
Ejemplo n.º 18
0
        internal static WebPageMatch MatchRequest(string pathValue, IEnumerable<string> supportedExtensions, IVirtualPathFactory virtualPathFactory, HttpContextBase context, DisplayModeProvider displayModes)
        {
            string currentLevel = String.Empty;
            string currentPathInfo = pathValue;

            // We can skip the file exists check and normal lookup for empty paths, but we still need to look for default pages
            if (!String.IsNullOrEmpty(pathValue))
            {
                // If the file exists and its not a supported extension, let the request go through
                if (FileExists(pathValue, virtualPathFactory))
                {
                    // TODO: Look into switching to RawURL to eliminate the need for this issue
                    bool foundSupportedExtension = false;
                    foreach (string supportedExtension in supportedExtensions)
                    {
                        if (pathValue.EndsWith("." + supportedExtension, StringComparison.OrdinalIgnoreCase))
                        {
                            foundSupportedExtension = true;
                            break;
                        }
                    }

                    if (!foundSupportedExtension)
                    {
                        return null;
                    }
                }

                // For each trimmed part of the path try to add a known extension and
                // check if it matches a file in the application.
                currentLevel = pathValue;
                currentPathInfo = String.Empty;
                while (true)
                {
                    // Does the current route level patch any supported extension?
                    string routeLevelMatch = GetRouteLevelMatch(currentLevel, supportedExtensions, virtualPathFactory, context, displayModes);
                    if (routeLevelMatch != null)
                    {
                        return new WebPageMatch(routeLevelMatch, currentPathInfo);
                    }

                    // Try to remove the last path segment (e.g. go from /foo/bar to /foo)
                    int indexOfLastSlash = currentLevel.LastIndexOf('/');
                    if (indexOfLastSlash == -1)
                    {
                        // If there are no more slashes, we're done
                        break;
                    }
                    else
                    {
                        // Chop off the last path segment to get to the next one
                        currentLevel = currentLevel.Substring(0, indexOfLastSlash);

                        // And save the path info in case there is a match
                        currentPathInfo = pathValue.Substring(indexOfLastSlash + 1);
                    }
                }
            }

            return MatchDefaultFiles(pathValue, supportedExtensions, virtualPathFactory, context, displayModes, currentLevel);
        }
 public static void RegisterFactory(IVirtualPathFactory factory)
 {
     Instance.Factories.Add(factory);
 }
Ejemplo n.º 20
0
        private static string GetRouteLevelMatch(string pathValue, IEnumerable <string> supportedExtensions, IVirtualPathFactory virtualPathFactory, HttpContextBase context, DisplayModeProvider displayModeProvider)
        {
            foreach (string supportedExtension in supportedExtensions)
            {
                string virtualPath = "~/" + pathValue;

                // Only add the extension if it's not already there
                if (!virtualPath.EndsWith("." + supportedExtension, StringComparison.OrdinalIgnoreCase))
                {
                    virtualPath += "." + supportedExtension;
                }
                DisplayInfo virtualPathDisplayInfo = displayModeProvider.GetDisplayInfoForVirtualPath(virtualPath, context, virtualPathFactory.Exists, currentDisplayMode: null);

                if (virtualPathDisplayInfo != null)
                {
                    // If there's an exact match on disk, return it unless it starts with an underscore
                    if (Path.GetFileName(virtualPathDisplayInfo.FilePath).StartsWith("_", StringComparison.OrdinalIgnoreCase))
                    {
                        throw new HttpException(404, WebPageResources.WebPageRoute_UnderscoreBlocked);
                    }

                    string resolvedVirtualPath = virtualPathDisplayInfo.FilePath;

                    // Matches are not expected to be virtual paths so remove the ~/ from the match
                    if (resolvedVirtualPath.StartsWith("~/", StringComparison.OrdinalIgnoreCase))
                    {
                        resolvedVirtualPath = resolvedVirtualPath.Remove(0, 2);
                    }

                    DisplayModeProvider.SetDisplayMode(context, virtualPathDisplayInfo.DisplayMode);

                    return(resolvedVirtualPath);
                }
            }

            return(null);
        }
Ejemplo n.º 21
0
        private static bool FileExists(string virtualPath, IVirtualPathFactory virtualPathFactory)
        {
            var path = "~/" + virtualPath;

            return(virtualPathFactory.Exists(path));
        }
Ejemplo n.º 22
0
        private static WebPageMatch MatchDefaultFiles(string pathValue, IEnumerable <string> supportedExtensions, IVirtualPathFactory virtualPathFactory, HttpContextBase context, DisplayModeProvider displayModes, string currentLevel)
        {
            // If we haven't found anything yet, now try looking for default.* or index.* at the current url
            currentLevel = pathValue;
            string currentLevelDefault;
            string currentLevelIndex;

            if (String.IsNullOrEmpty(currentLevel))
            {
                currentLevelDefault = "default";
                currentLevelIndex   = "index";
            }
            else
            {
                if (currentLevel[currentLevel.Length - 1] != '/')
                {
                    currentLevel += "/";
                }
                currentLevelDefault = currentLevel + "default";
                currentLevelIndex   = currentLevel + "index";
            }

            // Does the current route level match any supported extension?
            string defaultMatch = GetRouteLevelMatch(currentLevelDefault, supportedExtensions, virtualPathFactory, context, displayModes);

            if (defaultMatch != null)
            {
                return(new WebPageMatch(defaultMatch, String.Empty));
            }

            string indexMatch = GetRouteLevelMatch(currentLevelIndex, supportedExtensions, virtualPathFactory, context, displayModes);

            if (indexMatch != null)
            {
                return(new WebPageMatch(indexMatch, String.Empty));
            }

            return(null);
        }
Ejemplo n.º 23
0
        internal static WebPageMatch MatchRequest(string pathValue, IEnumerable <string> supportedExtensions, IVirtualPathFactory virtualPathFactory, HttpContextBase context, DisplayModeProvider displayModes)
        {
            string currentLevel    = String.Empty;
            string currentPathInfo = pathValue;

            // We can skip the file exists check and normal lookup for empty paths, but we still need to look for default pages
            if (!String.IsNullOrEmpty(pathValue))
            {
                // If the file exists and its not a supported extension, let the request go through
                if (FileExists(pathValue, virtualPathFactory))
                {
                    // TODO: Look into switching to RawURL to eliminate the need for this issue
                    bool foundSupportedExtension = false;
                    foreach (string supportedExtension in supportedExtensions)
                    {
                        if (pathValue.EndsWith("." + supportedExtension, StringComparison.OrdinalIgnoreCase))
                        {
                            foundSupportedExtension = true;
                            break;
                        }
                    }

                    if (!foundSupportedExtension)
                    {
                        return(null);
                    }
                }

                // For each trimmed part of the path try to add a known extension and
                // check if it matches a file in the application.
                currentLevel    = pathValue;
                currentPathInfo = String.Empty;
                while (true)
                {
                    // Does the current route level patch any supported extension?
                    string routeLevelMatch = GetRouteLevelMatch(currentLevel, supportedExtensions, virtualPathFactory, context, displayModes);
                    if (routeLevelMatch != null)
                    {
                        return(new WebPageMatch(routeLevelMatch, currentPathInfo));
                    }

                    // Try to remove the last path segment (e.g. go from /foo/bar to /foo)
                    int indexOfLastSlash = currentLevel.LastIndexOf('/');
                    if (indexOfLastSlash == -1)
                    {
                        // If there are no more slashes, we're done
                        break;
                    }
                    else
                    {
                        // Chop off the last path segment to get to the next one
                        currentLevel = currentLevel.Substring(0, indexOfLastSlash);

                        // And save the path info in case there is a match
                        currentPathInfo = pathValue.Substring(indexOfLastSlash + 1);
                    }
                }
            }

            return(MatchDefaultFiles(pathValue, supportedExtensions, virtualPathFactory, context, displayModes, currentLevel));
        }
Ejemplo n.º 24
0
 internal static WebPageBase CreateInstanceFromVirtualPath(string virtualPath, IVirtualPathFactory virtualPathFactory)
 {
     try
       {
     WebPageBase instance = VirtualPathFactoryExtensions.CreateInstance<WebPageBase>(virtualPathFactory, virtualPath);
     instance.VirtualPath = virtualPath;
     instance.VirtualPathFactory = virtualPathFactory;
     return instance;
       }
       catch (HttpException ex)
       {
     BuildManagerExceptionUtil.ThrowIfUnsupportedExtension(virtualPath, ex);
     throw;
       }
 }
Ejemplo n.º 25
0
        private static WebPageMatch MatchDefaultFiles(string pathValue, IEnumerable<string> supportedExtensions, IVirtualPathFactory virtualPathFactory, HttpContextBase context, DisplayModeProvider displayModes, string currentLevel)
        {
            // If we haven't found anything yet, now try looking for default.* or index.* at the current url
            currentLevel = pathValue;
            string currentLevelDefault;
            string currentLevelIndex;
            if (String.IsNullOrEmpty(currentLevel))
            {
                currentLevelDefault = "default";
                currentLevelIndex = "index";
            }
            else
            {
                if (currentLevel[currentLevel.Length - 1] != '/')
                {
                    currentLevel += "/";
                }
                currentLevelDefault = currentLevel + "default";
                currentLevelIndex = currentLevel + "index";
            }

            // Does the current route level match any supported extension?
            string defaultMatch = GetRouteLevelMatch(currentLevelDefault, supportedExtensions, virtualPathFactory, context, displayModes);
            if (defaultMatch != null)
            {
                return new WebPageMatch(defaultMatch, String.Empty);
            }

            string indexMatch = GetRouteLevelMatch(currentLevelIndex, supportedExtensions, virtualPathFactory, context, displayModes);
            if (indexMatch != null)
            {
                return new WebPageMatch(indexMatch, String.Empty);
            }

            return null;
        }
Ejemplo n.º 26
0
 private static bool FileExists(string virtualPath, IVirtualPathFactory virtualPathFactory)
 {
     var path = "~/" + virtualPath;
     return virtualPathFactory.Exists(path);
 }
Ejemplo n.º 27
0
        internal static WebPageBase CreateInstanceFromVirtualPath(string virtualPath, IVirtualPathFactory virtualPathFactory)
        {
            // Get the compiled object
            try
            {
                WebPageBase webPage = virtualPathFactory.CreateInstance<WebPageBase>(virtualPath);

                // Give it its virtual path
                webPage.VirtualPath = virtualPath;

                // Assign it the VirtualPathFactory
                webPage.VirtualPathFactory = virtualPathFactory;

                return webPage;
            }
            catch (HttpException e)
            {
                BuildManagerExceptionUtil.ThrowIfUnsupportedExtension(virtualPath, e);
                throw;
            }
        }
 internal void RegisterVirtualPathFactoryInternal(IVirtualPathFactory virtualPathFactory)
 {
     _virtualPathFactories.Add(virtualPathFactory);
 }
 public PrecompiledVirtualPathFactory(Func<string, Type> pathLookup, IVirtualPathFactory backup)
 {
     PathLookup = pathLookup;
     Backup = backup;
 }
Ejemplo n.º 30
0
 internal VirtualPathFactoryManager(IVirtualPathFactory defaultFactory)
 {
     _virtualPathFactories.AddFirst(defaultFactory);
 }
 public PrecompiledVirtualPathFactory(Func <string, Type> pathLookup, IVirtualPathFactory backup)
 {
     PathLookup = pathLookup;
     Backup     = backup;
 }
 public static void RegisterVirtualPathFactory(IVirtualPathFactory virtualPathFactory)
 {
     Instance.RegisterVirtualPathFactoryInternal(virtualPathFactory);
 }