private void ConstructorHelper(int exprIndex, RuntimeHierarchyObjReference hierarchyRoot)
 {
     m_hierarchyRoot = hierarchyRoot;
     using (m_hierarchyRoot.PinValue())
     {
         RuntimeGroupRootObj runtimeGroupRootObj = m_hierarchyRoot.Value() as RuntimeGroupRootObj;
         Global.Tracer.Assert(runtimeGroupRootObj != null, "(null != groupRoot)");
         List <Microsoft.ReportingServices.ReportIntermediateFormat.ExpressionInfo> list;
         IndexedExprHost expressionsHost;
         List <bool>     directions;
         if (ProcessingStages.Grouping == runtimeGroupRootObj.ProcessingStage)
         {
             list            = runtimeGroupRootObj.GroupExpressions;
             expressionsHost = runtimeGroupRootObj.GroupExpressionHost;
             directions      = runtimeGroupRootObj.GroupDirections;
         }
         else
         {
             Global.Tracer.Assert(ProcessingStages.SortAndFilter == runtimeGroupRootObj.ProcessingStage, "(ProcessingStages.SortAndFilter == groupRoot.ProcessingStage)");
             list            = runtimeGroupRootObj.SortExpressions;
             expressionsHost = runtimeGroupRootObj.SortExpressionHost;
             directions      = runtimeGroupRootObj.SortDirections;
         }
         if (exprIndex == -1 || exprIndex >= list.Count)
         {
             m_hierarchyObjs = new List <IReference <RuntimeHierarchyObj> >();
             RuntimeGroupLeafObjReference runtimeGroupLeafObjReference = null;
             _ = m_odpContext.TablixProcessingScalabilityCache;
             if (ProcessingStages.Grouping == runtimeGroupRootObj.ProcessingStage)
             {
                 runtimeGroupLeafObjReference = runtimeGroupRootObj.CreateGroupLeaf();
                 if (!runtimeGroupRootObj.HasParent)
                 {
                     runtimeGroupRootObj.AddChildWithNoParent(runtimeGroupLeafObjReference);
                 }
             }
             if (null != runtimeGroupLeafObjReference)
             {
                 m_hierarchyObjs.Add(runtimeGroupLeafObjReference);
             }
         }
         else
         {
             m_expression = new RuntimeExpressionInfo(list, expressionsHost, directions, exprIndex);
             m_grouping   = RuntimeGroupingObj.CreateGroupingObj(runtimeGroupRootObj.GroupingType, this, m_objectType);
         }
     }
 }
Пример #2
0
 protected RuntimeGroupRootObj(IReference <IScope> outerScope, Microsoft.ReportingServices.ReportIntermediateFormat.ReportHierarchyNode hierarchyDef, DataActions dataAction, OnDemandProcessingContext odpContext, Microsoft.ReportingServices.ReportProcessing.ObjectType objectType)
     : base(odpContext, objectType, outerScope.Value().Depth + 1)
 {
     m_hierarchyRoot = (RuntimeHierarchyObjReference)m_selfReference;
     m_outerScope    = outerScope;
     m_hierarchyDef  = hierarchyDef;
     Microsoft.ReportingServices.ReportIntermediateFormat.Grouping grouping = hierarchyDef.Grouping;
     Global.Tracer.Assert(grouping != null, "(null != groupDef)");
     m_isDetailGroup = grouping.IsDetail;
     if (m_isDetailGroup)
     {
         m_expression = null;
     }
     else
     {
         m_expression = new RuntimeExpressionInfo(grouping.GroupExpressions, grouping.ExprHost, grouping.SortDirections, 0);
     }
     if (m_odpContext.RuntimeSortFilterInfo != null)
     {
         int count = m_odpContext.RuntimeSortFilterInfo.Count;
         using (outerScope.PinValue())
         {
             IScope scope = outerScope.Value();
             for (int i = 0; i < count; i++)
             {
                 IReference <RuntimeSortFilterEventInfo> reference = m_odpContext.RuntimeSortFilterInfo[i];
                 using (reference.PinValue())
                 {
                     RuntimeSortFilterEventInfo runtimeSortFilterEventInfo = reference.Value();
                     if (runtimeSortFilterEventInfo.EventSource.ContainingScopes != null && runtimeSortFilterEventInfo.EventSource.ContainingScopes.Count != 0 && !runtimeSortFilterEventInfo.HasEventSourceScope && (!m_isDetailGroup || !runtimeSortFilterEventInfo.EventSource.IsSubReportTopLevelScope))
                     {
                         continue;
                     }
                     bool flag = false;
                     if (m_isDetailGroup)
                     {
                         if (!scope.TargetForNonDetailSort && IsTargetForSort(i, detailSort: true) && runtimeSortFilterEventInfo.EventTarget != base.SelfReference && scope.TargetScopeMatched(i, detailSort: true))
                         {
                             flag = true;
                             if (m_detailUserSortTargetInfo == null)
                             {
                                 m_detailUserSortTargetInfo = new RuntimeUserSortTargetInfo((IReference <IHierarchyObj>)base.SelfReference, i, reference);
                             }
                             else
                             {
                                 m_detailUserSortTargetInfo.AddSortInfo((IReference <IHierarchyObj>)base.SelfReference, i, reference);
                             }
                         }
                     }
                     else if (grouping.IsSortFilterExpressionScope != null)
                     {
                         flag = (grouping.IsSortFilterExpressionScope[i] && m_odpContext.UserSortFilterContext.InProcessUserSortPhase(i) && TargetScopeMatched(i, detailSort: false));
                     }
                     if (flag)
                     {
                         if (m_builtinSortOverridden == null)
                         {
                             m_builtinSortOverridden = new bool[count];
                         }
                         m_builtinSortOverridden[i] = true;
                     }
                 }
             }
         }
     }
     if (m_detailUserSortTargetInfo != null)
     {
         m_groupingType = RuntimeGroupingObj.GroupingTypes.DetailUserSort;
     }
     else if (grouping.GroupAndSort && !BuiltinSortOverridden)
     {
         m_groupingType = RuntimeGroupingObj.GroupingTypes.Sort;
     }
     else if (grouping.IsDetail && grouping.Parent == null && !BuiltinSortOverridden)
     {
         m_groupingType = RuntimeGroupingObj.GroupingTypes.Detail;
     }
     else if (grouping.NaturalGroup)
     {
         m_groupingType = RuntimeGroupingObj.GroupingTypes.NaturalGroup;
     }
     else
     {
         m_groupingType = RuntimeGroupingObj.GroupingTypes.Hash;
     }
     m_grouping = RuntimeGroupingObj.CreateGroupingObj(m_groupingType, this, objectType);
     if (grouping.Filters == null)
     {
         m_dataAction      = dataAction;
         m_outerDataAction = dataAction;
     }
     if (grouping.RecursiveAggregates != null)
     {
         m_dataAction |= DataActions.RecursiveAggregates;
     }
     if (grouping.PostSortAggregates != null)
     {
         m_dataAction |= DataActions.PostSortAggregates;
     }
     if (grouping.Parent != null)
     {
         m_parentExpression = new RuntimeExpressionInfo(grouping.Parent, grouping.ParentExprHost, null, 0);
     }
 }