Ejemplo n.º 1
0
        internal PivotCacheDefinition ToPivotCacheDefinition()
        {
            var pcd = new PivotCacheDefinition();

            if ((Id != null) && (Id.Length > 0))
            {
                pcd.Id = Id;
            }
            if (Invalid)
            {
                pcd.Invalid = Invalid;
            }
            if (SaveData != true)
            {
                pcd.SaveData = SaveData;
            }
            if (RefreshOnLoad)
            {
                pcd.RefreshOnLoad = RefreshOnLoad;
            }
            if (OptimizeMemory)
            {
                pcd.OptimizeMemory = OptimizeMemory;
            }
            if (EnableRefresh != true)
            {
                pcd.EnableRefresh = EnableRefresh;
            }
            if ((RefreshedBy != null) && (RefreshedBy.Length > 0))
            {
                pcd.RefreshedBy = RefreshedBy;
            }
            if (RefreshedDate != null)
            {
                pcd.RefreshedDate = RefreshedDate.Value;
            }
            if (BackgroundQuery)
            {
                pcd.BackgroundQuery = BackgroundQuery;
            }
            if (MissingItemsLimit != null)
            {
                pcd.MissingItemsLimit = MissingItemsLimit.Value;
            }
            if (CreatedVersion != 0)
            {
                pcd.CreatedVersion = CreatedVersion;
            }
            if (RefreshedVersion != 0)
            {
                pcd.RefreshedVersion = RefreshedVersion;
            }
            if (MinRefreshableVersion != 0)
            {
                pcd.MinRefreshableVersion = MinRefreshableVersion;
            }
            if (RecordCount != null)
            {
                pcd.RecordCount = RecordCount.Value;
            }
            if (UpgradeOnRefresh)
            {
                pcd.UpgradeOnRefresh = UpgradeOnRefresh;
            }
            if (IsTupleCache)
            {
                pcd.IsTupleCache = IsTupleCache;
            }
            if (SupportSubquery)
            {
                pcd.SupportSubquery = SupportSubquery;
            }
            if (SupportAdvancedDrill)
            {
                pcd.SupportAdvancedDrill = SupportAdvancedDrill;
            }

            pcd.CacheSource = CacheSource.ToCacheSource();

            pcd.CacheFields = new CacheFields {
                Count = (uint)CacheFields.Count
            };
            foreach (var cf in CacheFields)
            {
                pcd.CacheFields.Append(cf.ToCacheField());
            }

            if (CacheHierarchies.Count > 0)
            {
                pcd.CacheHierarchies = new CacheHierarchies {
                    Count = (uint)CacheHierarchies.Count
                };
                foreach (var ch in CacheHierarchies)
                {
                    pcd.CacheHierarchies.Append(ch.ToCacheHierarchy());
                }
            }

            if (Kpis.Count > 0)
            {
                pcd.Kpis = new Kpis {
                    Count = (uint)Kpis.Count
                };
                foreach (var k in Kpis)
                {
                    pcd.Kpis.Append(k.ToKpi());
                }
            }

            if (HasTupleCache)
            {
                pcd.TupleCache = TupleCache.ToTupleCache();
            }

            if (CalculatedItems.Count > 0)
            {
                pcd.CalculatedItems = new CalculatedItems {
                    Count = (uint)CalculatedItems.Count
                };
                foreach (var ci in CalculatedItems)
                {
                    pcd.CalculatedItems.Append(ci.ToCalculatedItem());
                }
            }

            if (CalculatedMembers.Count > 0)
            {
                pcd.CalculatedMembers = new CalculatedMembers {
                    Count = (uint)CalculatedMembers.Count
                };
                foreach (var cm in CalculatedMembers)
                {
                    pcd.CalculatedMembers.Append(cm.ToCalculatedMember());
                }
            }

            if (Dimensions.Count > 0)
            {
                pcd.Dimensions = new Dimensions {
                    Count = (uint)Dimensions.Count
                };
                foreach (var d in Dimensions)
                {
                    pcd.Dimensions.Append(d.ToDimension());
                }
            }

            if (MeasureGroups.Count > 0)
            {
                pcd.MeasureGroups = new MeasureGroups {
                    Count = (uint)MeasureGroups.Count
                };
                foreach (var mg in MeasureGroups)
                {
                    pcd.MeasureGroups.Append(mg.ToMeasureGroup());
                }
            }

            if (Maps.Count > 0)
            {
                pcd.Maps = new Maps {
                    Count = (uint)Maps.Count
                };
                foreach (var mdm in Maps)
                {
                    pcd.Maps.Append(mdm.ToMeasureDimensionMap());
                }
            }

            return(pcd);
        }