コード例 #1
0
        internal void Initialize()
        {
            Result = new QueryResult();

            if (ChainedQueryDimensions.Count > 0)
            {
                // we have a chained dimension.
                // Create result and recurse initialisation
                var qDim = ChainedQueryDimensions.First();
                TopLevelQueryDimensions.Add(qDim);
                qDim.AddMeasures(Measures);

                var dimResult = new DimensionResult <TFact>(qDim, Measures);
                ((IDictionary <IDimension, IDimensionEntryResult>)Result)[qDim.Dimension] = dimResult;
                dimResult.Initialize(ChainedQueryDimensions.Skip(1), CrossingQueryDimensions, null);
            }
            else
            {
                // no chained dimensions set
                // generate all crossing permutations
                foreach (var qDim in CrossingQueryDimensions)
                {
                    TopLevelQueryDimensions.Add(qDim);
                    qDim.AddMeasures(Measures);

                    var dimResult = new DimensionResult <TFact>(qDim, Measures);
                    ((IDictionary <IDimension, IDimensionEntryResult>)Result)[qDim.Dimension] = dimResult;
                    dimResult.Initialize(null, CrossingQueryDimensions.Where(i => i != qDim), null);
                }
            }
        }
コード例 #2
0
        /// <summary>
        /// Initialize the entry result
        /// </summary>
        /// <param name="chainedDimensions"></param>
        /// <param name="crossingDimensions"></param>
        /// <param name="parentCoordinate"></param>
        public void Initialize(IEnumerable <IQueryDimension> chainedDimensions, IEnumerable <IQueryDimension> crossingDimensions, IDimensionEntryResult parentCoordinate)
        {
            ParentCoordinate = parentCoordinate;
            foreach (var child in DimensionEntry.Children)
            {
                var result = new DimensionEntryResult <TFact>(child, Measures);
                Entries[child] = result;
                result.Initialize(chainedDimensions, crossingDimensions, parentCoordinate);
            }

            var nextDim = chainedDimensions == null ? null : chainedDimensions.FirstOrDefault();

            if (nextDim != null)
            {
                // we have a "next" chained dimension.
                // Create result and recurse initialisation
                var nextResult = new DimensionResult <TFact>(nextDim, Measures);
                OtherDimensions[nextDim] = nextResult;
                nextResult.Initialize(chainedDimensions.Skip(1), crossingDimensions, this);
            }
            else
            {
                // no chained dimensions left
                // generate all crossing permutations
                foreach (var other in crossingDimensions)
                {
                    var otherResult = new DimensionResult <TFact>(other, Measures);
                    OtherDimensions[other] = otherResult;
                    otherResult.Initialize(null, crossingDimensions.Where(i => i != other), this);
                }
            }

            foreach (var measure in Measures)
            {
                Values[measure] = measure.CreateResult();
            }
        }