Beispiel #1
0
 public Stream GetProjection(Guid id, string name, string nmspace, HierarchyQuery query = null)
 {
     CheckInitialization();
     try
     {
         _storage.StartReading();
         var root = _projStorage.FindElement(name, nmspace);
         if (root == null)
         {
             throw new ArgumentException("Ќевозможно получить проекцию - не найден переданный элемент");
         }
         var procQuery       = new ProcessorQuery(query);
         var parametersQuery = procQuery.Query
                               .ByDefault(
             k2 => k2.ToDictionary(k => k.Key, k => k.Value, StringComparer.InvariantCultureIgnoreCase),
             new Dictionary <string, string>());
         Debug.Assert(root != null);
         var parameterNames      = new ParameterNames(parametersQuery.Select(k => k.Key));
         var plan                = ChoosePlan(root, procQuery.LeftDepth, parameterNames);
         var conversedParameters = plan.ConverseArguments(parametersQuery);
         var stream              = RealisePlan(plan, id, nmspace, procQuery.LeftDepth, _streamer, conversedParameters);
         stream.Position = 0;
         return(stream);
     }
     finally
     {
         _storage.StopReading();
     }
 }
Beispiel #2
0
 public ProcessorQuery(HierarchyQuery query)
 {
     if (query != null)
     {
         LeftDepth = query.AreaDepth == 0?-1:query.AreaDepth;
         RemainingElemens = (query.RequiredElemens??new Guid[0]).ToList();
         MaxItems = query.MaxItems == 0 ? int.MaxValue : query.MaxItems;
         if (query.Query!=null)
            Query = new UriQuery(query.Query);
     }
     else
     {
         LeftDepth = -1;
         RemainingElemens = new List<Guid>();
         MaxItems = int.MaxValue;
       
     }
 }
Beispiel #3
0
 public ProcessorQuery(HierarchyQuery query)
 {
     if (query != null)
     {
         LeftDepth        = query.AreaDepth == 0?-1:query.AreaDepth;
         RemainingElemens = (query.RequiredElemens ?? new Guid[0]).ToList();
         MaxItems         = query.MaxItems == 0 ? int.MaxValue : query.MaxItems;
         if (query.Query != null)
         {
             Query = new UriQuery(query.Query);
         }
     }
     else
     {
         LeftDepth        = -1;
         RemainingElemens = new List <Guid>();
         MaxItems         = int.MaxValue;
     }
 }