コード例 #1
0
        internal CubeCollectionInternal(AdomdConnection connection) : base(connection)
        {
            ListDictionary restrictions = new ListDictionary();

            AdomdUtils.AddCubeSourceRestrictionIfApplicable(connection, restrictions);
            ObjectMetadataCache objectCache = new ObjectMetadataCache(connection, InternalObjectType.InternalTypeCube, CubeCollectionInternal.schemaName, restrictions);

            base.Initialize(objectCache);
        }
コード例 #2
0
        internal CubeMetadataCache(AdomdConnection connection, CubeDef parentCube)
        {
            this.msgDelegate         = new AdomdUtils.GetInvalidatedMessageDelegate(this.GetCubesUpdatedMessage);
            this.connection          = connection;
            this.parentCube          = parentCube;
            this.cacheState          = MetadataCacheState.UpToDate;
            this.cacheDataset        = new DataSet();
            this.cacheDataset.Locale = CultureInfo.InvariantCulture;
            this.restrictions        = new ListDictionary();
            this.restrictions.Add(CubeCollectionInternal.cubeNameRest, parentCube.Name);
            AdomdUtils.AddCubeSourceRestrictionIfApplicable(this.connection, this.restrictions);
            int count = CubeMetadataCache.internalTypeMap.Count;

            this.objectMetadataCaches = new ObjectMetadataCache[count];
            bool flag = AdomdUtils.ShouldAddObjectVisibilityRestriction(this.connection);

            for (int i = 0; i < count; i++)
            {
                ListDictionary destinationRestrictions;
                if (flag || CubeMetadataCache.SchemaRowsetsData[i].HasAdditionalRestrictions)
                {
                    destinationRestrictions = new ListDictionary();
                    AdomdUtils.CopyRestrictions(this.restrictions, destinationRestrictions);
                    if (CubeMetadataCache.SchemaRowsetsData[i].HasAdditionalRestrictions)
                    {
                        CubeMetadataCache.AddSpecificRestrictions(CubeMetadataCache.SchemaRowsetsData[i], destinationRestrictions);
                    }
                    if (flag)
                    {
                        AdomdUtils.AddObjectVisibilityRestrictionIfApplicable(this.connection, CubeMetadataCache.SchemaRowsetsData[i].RequestType, destinationRestrictions);
                    }
                }
                else
                {
                    destinationRestrictions = this.restrictions;
                }
                this.objectMetadataCaches[i] = new ObjectMetadataCache(this, connection, CubeMetadataCache.SchemaRowsetsData[i], destinationRestrictions);
            }
            this.lastCacheValidationTime = parentCube.PopulatedTime;
            this.cubeInfoTable           = new DataTable();
            this.cubeInfoTable.Locale    = CultureInfo.InvariantCulture;
            this.cubeInfoTable           = ((DataRow)((IAdomdBaseObject)parentCube).MetadataData).Table.Clone();
            this.originalTimeColumn      = ((DataRow)((IAdomdBaseObject)parentCube).MetadataData).Table.Columns[CubeDef.lastSchemaUpdateColumn];
            this.currentTimeColumn       = this.cubeInfoTable.Columns[CubeDef.lastSchemaUpdateColumn];
        }
        internal object InternalGetSchemaObject(SchemaObjectType schemaObjectType, string uniqueName, bool retryUniqueName)
        {
            DataRow dataRow;

            if (SchemaObjectType.ObjectTypeMember == schemaObjectType)
            {
                ListDictionary listDictionary = new ListDictionary();
                listDictionary.Add(CubeCollectionInternal.cubeNameRest, this.Name);
                AdomdUtils.AddCubeSourceRestrictionIfApplicable(this.Connection, listDictionary);
                string requestType = "MDSCHEMA_MEMBERS";
                string key         = "MEMBER_UNIQUE_NAME";
                listDictionary.Add(key, uniqueName);
                AdomdUtils.AddMemberBinaryRestrictionIfApplicable(this.Connection, listDictionary);
                DataRowCollection rows = AdomdUtils.GetRows(this.Connection, requestType, listDictionary);
                if (rows.Count != 1)
                {
                    throw new ArgumentException(SR.Indexer_ObjectNotFound(uniqueName), "uniqueName");
                }
                dataRow = rows[0];
            }
            else
            {
                dataRow = this.metadataCache.FindObjectByUniqueName(schemaObjectType, uniqueName);
                if (dataRow == null && retryUniqueName)
                {
                    ListDictionary listDictionary2 = new ListDictionary();
                    listDictionary2.Add(CubeCollectionInternal.cubeNameRest, this.Name);
                    AdomdUtils.AddCubeSourceRestrictionIfApplicable(this.Connection, listDictionary2);
                    string schemaName;
                    string text;
                    switch (schemaObjectType)
                    {
                    case SchemaObjectType.ObjectTypeDimension:
                        schemaName = DimensionCollectionInternal.schemaName;
                        text       = DimensionCollectionInternal.dimUNameRest;
                        goto IL_16D;

                    case SchemaObjectType.ObjectTypeHierarchy:
                        schemaName = HierarchyCollectionInternal.schemaName;
                        text       = HierarchyCollectionInternal.hierUNameRest;
                        goto IL_16D;

                    case SchemaObjectType.ObjectTypeLevel:
                        schemaName = LevelCollectionInternal.schemaName;
                        text       = LevelCollectionInternal.levelUNameRest;
                        goto IL_16D;

                    case SchemaObjectType.ObjectTypeMember:
                    case (SchemaObjectType)5:
                        break;

                    case SchemaObjectType.ObjectTypeMeasure:
                        schemaName = MeasureCollectionInternal.schemaName;
                        text       = Measure.uniqueNameColumn;
                        goto IL_16D;

                    case SchemaObjectType.ObjectTypeKpi:
                        schemaName = KpiCollectionInternal.schemaName;
                        text       = Kpi.kpiNameColumn;
                        goto IL_16D;

                    default:
                        if (schemaObjectType == SchemaObjectType.ObjectTypeNamedSet)
                        {
                            schemaName = NamedSetCollectionInternal.schemaName;
                            text       = "SET_NAME";
                            goto IL_16D;
                        }
                        break;
                    }
                    throw new ArgumentOutOfRangeException("schemaObjectType");
IL_16D:
                    listDictionary2.Add(text, uniqueName);
                    AdomdUtils.AddObjectVisibilityRestrictionIfApplicable(this.Connection, schemaName, listDictionary2);
                    DataRowCollection rows2 = AdomdUtils.GetRows(this.Connection, schemaName, listDictionary2);
                    if (rows2.Count > 0)
                    {
                        uniqueName = (rows2[0][text] as string);
                        if (uniqueName != null)
                        {
                            dataRow = this.metadataCache.FindObjectByUniqueName(schemaObjectType, uniqueName);
                        }
                    }
                }
            }
            if (dataRow == null)
            {
                throw new ArgumentException(SR.Indexer_ObjectNotFound(uniqueName), "uniqueName");
            }
            switch (schemaObjectType)
            {
            case SchemaObjectType.ObjectTypeDimension:
            {
                object result = DimensionCollectionInternal.GetDimensionByRow(this.Connection, dataRow, this, this.baseData.Catalog, this.baseData.SessionID);
                return(result);
            }

            case SchemaObjectType.ObjectTypeHierarchy:
            {
                Dimension parentDimension = (Dimension)this.InternalGetSchemaObject(SchemaObjectType.ObjectTypeDimension, dataRow[Dimension.uniqueNameColumn].ToString());
                object    result          = HierarchyCollectionInternal.GetHiearchyByRow(this.Connection, dataRow, parentDimension, this.baseData.Catalog, this.baseData.SessionID);
                return(result);
            }

            case SchemaObjectType.ObjectTypeLevel:
            {
                string    uniqueName2     = dataRow[Hierarchy.uniqueNameColumn].ToString();
                Hierarchy parentHierarchy = (Hierarchy)this.InternalGetSchemaObject(SchemaObjectType.ObjectTypeHierarchy, uniqueName2);
                object    result          = LevelCollectionInternal.GetLevelByRow(this.Connection, dataRow, parentHierarchy, this.baseData.Catalog, this.baseData.SessionID);
                return(result);
            }

            case SchemaObjectType.ObjectTypeMember:
            {
                object result = new Member(this.Connection, dataRow, null, null, MemberOrigin.Metadata, this.Name, null, -1, this.baseData.Catalog, this.baseData.SessionID);
                return(result);
            }

            case (SchemaObjectType)5:
                break;

            case SchemaObjectType.ObjectTypeMeasure:
            {
                object result = MeasureCollectionInternal.GetMeasureByRow(this.Connection, dataRow, this, this.baseData.Catalog, this.baseData.SessionID);
                return(result);
            }

            case SchemaObjectType.ObjectTypeKpi:
            {
                object result = KpiCollectionInternal.GetKpiByRow(this.Connection, dataRow, this, this.baseData.Catalog, this.baseData.SessionID);
                return(result);
            }

            default:
                if (schemaObjectType == SchemaObjectType.ObjectTypeNamedSet)
                {
                    object result = NamedSetCollectionInternal.GetNamedSetByRow(this.Connection, dataRow, this, this.baseData.Catalog, this.baseData.SessionID);
                    return(result);
                }
                break;
            }
            throw new ArgumentOutOfRangeException("schemaObjectType");
        }