Ejemplo n.º 1
0
 internal static void EnsureCacheNotAbandoned(MetadataCacheState state)
 {
     if (state == MetadataCacheState.Abandoned)
     {
         throw new InvalidOperationException(SR.MetadataCache_Abandoned);
     }
 }
Ejemplo n.º 2
0
 internal static void EnsureCacheNotInvalid(MetadataCacheState state, AdomdUtils.GetInvalidatedMessageDelegate msgDelegate)
 {
     if (state == MetadataCacheState.Invalid)
     {
         throw new AdomdCacheExpiredException(msgDelegate());
     }
 }
Ejemplo n.º 3
0
 internal void PopulateSelf()
 {
     if (this.connection == null)
     {
         throw new NotSupportedException(SR.NotSupportedWhenConnectionMissing);
     }
     AdomdUtils.CheckConnectionOpened(this.connection);
     if (!this.IsInitialized)
     {
         this.cacheTable        = new DataTable();
         this.cacheTable.Locale = CultureInfo.InvariantCulture;
         this.cacheTable.Columns.Add("ObjectColumn_ADOMDInternal$$", typeof(object));
     }
     if (this.isNestedSchema)
     {
         ObjectMetadataCache.DiscoverNested(this.connection, this.requestType, this.restrictions, out this.cacheDataSet);
         this.cacheTable.Columns.Add("__RowIndex__", typeof(int));
         object[] array = new object[2];
         for (int i = 0; i < this.cacheDataSet.Tables[0].Rows.Count; i++)
         {
             array[0] = null;
             array[1] = i;
             this.cacheTable.Rows.Add(array);
         }
     }
     else
     {
         ObjectMetadataCache.Discover(this.connection, this.requestType, this.restrictions, this.cacheTable, !this.isInitialized);
     }
     this.cacheState    = MetadataCacheState.UpToDate;
     this.isInitialized = true;
 }
Ejemplo n.º 4
0
        private void CheckCacheValid()
        {
            this.cubeInfoTable.Clear();
            ObjectMetadataCache.Discover(this.connection, CubeCollectionInternal.schemaName, this.restrictions, this.cubeInfoTable, false);
            bool flag;

            if (this.cubeInfoTable.Rows.Count <= 0)
            {
                flag = false;
            }
            else
            {
                DataRow dataRow = this.cubeInfoTable.Rows[0];
                flag = dataRow[this.currentTimeColumn].Equals(((DataRow)((IAdomdBaseObject)this.parentCube).MetadataData)[this.originalTimeColumn]);
            }
            this.lastCacheValidationTime = DateTime.Now;
            if (flag)
            {
                this.cacheState = MetadataCacheState.UpToDate;
            }
            else
            {
                this.cacheState = MetadataCacheState.Invalid;
            }
            this.EnsureValid();
        }
Ejemplo n.º 5
0
 void IMetadataCache.MarkNeedCheckForValidness()
 {
     if (this.cacheState == MetadataCacheState.UpToDate)
     {
         this.cacheState = MetadataCacheState.NeedsValidnessCheck;
     }
 }
Ejemplo n.º 6
0
 void IObjectCache.MarkAbandoned()
 {
     if (this.metadataCache != null)
     {
         this.metadataCache.MarkAbandoned();
         return;
     }
     this.cacheState = MetadataCacheState.Abandoned;
 }
Ejemplo n.º 7
0
 void IMetadataCache.MarkAbandoned()
 {
     this.cacheState = MetadataCacheState.Abandoned;
     ObjectMetadataCache[] array = this.objectMetadataCaches;
     for (int i = 0; i < array.Length; i++)
     {
         ObjectMetadataCache objectMetadataCache = array[i];
         objectMetadataCache.MarkAbandonedSelf();
     }
 }
Ejemplo n.º 8
0
 void IObjectCache.MarkNeedCheckForValidness()
 {
     if (this.metadataCache != null)
     {
         this.metadataCache.MarkNeedCheckForValidness();
         return;
     }
     if (this.cacheState == MetadataCacheState.UpToDate)
     {
         this.cacheState = MetadataCacheState.NeedsValidnessCheck;
     }
 }
Ejemplo n.º 9
0
 internal void RefreshSelf()
 {
     if (this.cacheState != MetadataCacheState.Empty)
     {
         if (this.cacheTable != null)
         {
             DataTable dataTable = this.cacheTable.Clone();
             this.cacheTable = dataTable;
         }
         this.cacheState = MetadataCacheState.Empty;
     }
 }
Ejemplo n.º 10
0
 internal ObjectMetadataCache(IMetadataCache metadataCache, AdomdConnection connection, InternalObjectType objectType, string requestType, ListDictionary restrictions, string relationColumn)
 {
     this.msgDelegate    = new AdomdUtils.GetInvalidatedMessageDelegate(this.GetMessageForCacheExpiration);
     this.isInitialized  = false;
     this.cacheState     = MetadataCacheState.Empty;
     this.metadataCache  = metadataCache;
     this.connection     = connection;
     this.objectType     = objectType;
     this.requestType    = requestType;
     this.restrictions   = restrictions;
     this.relationColumn = relationColumn;
 }
Ejemplo n.º 11
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];
        }
Ejemplo n.º 12
0
 void IObjectCache.CheckCacheIsValid()
 {
     if (this.IsPopulated)
     {
         if (this.metadataCache != null)
         {
             this.metadataCache.CheckCacheIsValid();
             return;
         }
         this.EnsureNotAbandoned();
         this.EnsureValid();
         if (this.NeedCheckForRefresh())
         {
             bool flag = true;
             if (this.cacheValidationTable == null)
             {
                 this.cacheValidationTable       = this.cacheTable.Clone();
                 this.cacheValidationColumnNames = ObjectMetadataCache.GetColumnNamesToCompareForUpdate(this.objectType);
             }
             else
             {
                 this.cacheValidationTable.Clear();
             }
             this.Discover(this.cacheValidationTable, false);
             if (this.cacheTable.Rows.Count != this.cacheValidationTable.Rows.Count)
             {
                 flag = false;
             }
             else if (this.cacheValidationColumnNames != null)
             {
                 for (int i = 0; i < this.cacheValidationTable.Rows.Count; i++)
                 {
                     DataRow  dataRow = this.cacheTable.Rows[i];
                     string[] array   = this.cacheValidationColumnNames;
                     for (int j = 0; j < array.Length; j++)
                     {
                         string columnName = array[j];
                         if (!object.Equals(dataRow[columnName], this.cacheValidationTable.Rows[i][columnName]))
                         {
                             flag = false;
                             break;
                         }
                     }
                     if (!flag)
                     {
                         break;
                     }
                 }
             }
             this.lastCacheValidationTime = DateTime.Now;
             if (!flag)
             {
                 this.cacheState = MetadataCacheState.Invalid;
             }
             else
             {
                 this.cacheState = MetadataCacheState.UpToDate;
             }
             this.EnsureValid();
         }
     }
 }
Ejemplo n.º 13
0
 internal void MarkAbandonedSelf()
 {
     this.cacheState = MetadataCacheState.Abandoned;
 }