public Measure this[int index] { get { if (index < 0 || index >= this.Count) { throw new ArgumentOutOfRangeException("index"); } DataRow row = this.internalCollection[index]; return(MeasureCollectionInternal.GetMeasureByRow(base.Connection, row, this.parentCube, base.Catalog, base.SessionId)); } }
public Measure Find(string index) { if (index == null) { throw new ArgumentNullException("index"); } DataRow dataRow = base.FindObjectByName(index, null, Measure.measureNameColumn); if (dataRow == null) { return(null); } return(MeasureCollectionInternal.GetMeasureByRow(base.Connection, dataRow, this.parentCube, base.Catalog, base.SessionId)); }
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"); }