SenseNet.ContentRepository.Storage.AppModel.ApplicationResolver.ResolveAllByPaths C# (CSharp) Метод

ResolveAllByPaths() статический приватный Метод

static private ResolveAllByPaths ( IEnumerable paths, bool resolveChildren ) : IEnumerable
paths IEnumerable
resolveChildren bool
Результат IEnumerable
        internal static IEnumerable<NodeHead> ResolveAllByPaths(IEnumerable<string> paths, bool resolveChildren)
        {
            if (StorageContext.Search.IsOuterEngineEnabled)
                return ResolveAllByPathsFromIndexedEngine(paths, resolveChildren);

            //if (appFolderName != null)
            //    return ResolveAllByPathsFromCache(paths, resolveChildren, appFolderName);

            var script = DataProvider.GetAppModelScript(paths, true, resolveChildren);
            var pathIndexer = paths.ToList();

            var proc = DataProvider.CreateDataProcedure(script);
            proc.CommandType = System.Data.CommandType.Text;

            var resultSorter = new List<NodeHead>[pathIndexer.Count];
            using (var reader = proc.ExecuteReader())
            {
                while (reader.Read())
                {
                    var nodeHead = NodeHead.Get(reader.GetInt32(0));
                    var searchPath = resolveChildren ? RepositoryPath.GetParentPath(nodeHead.Path) : nodeHead.Path;
                    var index = pathIndexer.IndexOf(searchPath);
                    if (resultSorter[index] == null)
                        resultSorter[index] = new List<NodeHead>();
                    resultSorter[index].Add(nodeHead);
                }
            }
            var result = new List<NodeHead>();
            foreach (var list in resultSorter)
                if (list != null)
                {
                    list.Sort(CompareByName);
                    foreach (var nodeHead in list)
                        result.Add(nodeHead);
                }
            return result;
        }
        private static IEnumerable<NodeHead> ResolveAllByPathsFromIndexedEngine(IEnumerable<string> paths, bool resolveChildren)

Usage Example

Пример #1
0
 public IEnumerable <NodeHead> ResolveAllByPaths(IEnumerable <string> paths, bool resolveChildren)
 {
     if (UseCache && AppCache != null)
     {
         return(ResolveByPathsFromCache(paths, resolveChildren, true));
     }
     return(ApplicationResolver.ResolveAllByPaths(paths, resolveChildren));
 }