private IReadOnlyList <ViewLocationCacheItem> GetViewStartPages( string path, HashSet <IChangeToken> expirationTokens) { var viewStartPages = new List <ViewLocationCacheItem>(); foreach (var viewStartProjectItem in _razorProject.FindHierarchicalItems(path, ViewStartFileName)) { var result = _pageFactory.CreateFactory(viewStartProjectItem.FilePath); var viewDescriptor = result.ViewDescriptor; if (viewDescriptor?.ExpirationTokens != null) { for (var i = 0; i < viewDescriptor.ExpirationTokens.Count; i++) { expirationTokens.Add(viewDescriptor.ExpirationTokens[i]); } } if (result.Success) { // Populate the viewStartPages list so that _ViewStarts appear in the order the need to be // executed (closest last, furthest first). This is the reverse order in which // ViewHierarchyUtility.GetViewStartLocations returns _ViewStarts. viewStartPages.Insert(0, new ViewLocationCacheItem(result.RazorPageFactory, viewStartProjectItem.FilePath)); } } return(viewStartPages); }
// Temporary API until we fully convert to RazorProjectEngine public IEnumerable <RazorProjectItem> GetHierarchicalImports(RazorProject project, RazorProjectItem projectItem) { // We want items in descending order. FindHierarchicalItems returns items in ascending order. return(project.FindHierarchicalItems(projectItem.FilePath, ImportsFileName).Reverse()); }