Esempio n. 1
0
        public XbimReadWriteTransaction BeginTransaction(string operationName)
        {
            if (InverseCache != null)
            {
                throw new XbimException("Transaction can't be open when cache is in operation.");
            }

            if (_editTransactionEntityCursor != null)
            {
                throw new XbimException("Attempt to begin another transaction whilst one is already running");
            }
            try
            {
                //check if write permission upgrade is required
                _editTransactionEntityCursor = InstanceCache.GetWriteableEntityTable();
                InstanceCache.BeginCaching();
                var txn = new XbimReadWriteTransaction(this, _editTransactionEntityCursor.BeginLazyTransaction(), operationName);
                CurrentTransaction = txn;
                return(txn);
            }
            catch (Exception e)
            {
                throw new XbimException("Failed to create ReadWrite transaction", e);
            }
        }
Esempio n. 2
0
 internal void EndTransaction()
 {
     //FreeTable(_editTransactionEntityCursor); //release the cursor back to the pool
     InstanceCache.EndCaching();
     _editTransactionEntityCursor.Dispose();
     _editTransactionEntityCursor = null;
 }
Esempio n. 3
0
 internal P21ToIndexParser(Stream inputP21, long streamSize, EsentEntityCursor table, PersistedEntityInstanceCache cache, int codePageOverride = -1)
     : base(inputP21)
 {
     this._table = table;
     //  this.transaction = transaction;
     _modelCache       = cache;
     _entityCount      = 0;
     _streamSize       = streamSize;
     _codePageOverride = codePageOverride;
 }
Esempio n. 4
0
 public XbimInstancesEntityEnumerator(PersistedEntityInstanceCache cache)
 {
     this.cache = cache;
     cursor     = cache.GetEntityTable();
     Reset();
 }
Esempio n. 5
0
 /// <summary>
 /// Returns the table to the cache for reuse
 /// </summary>
 /// <param name="table"></param>
 public void FreeTable(EsentEntityCursor table)
 {
     InstanceCache.FreeTable(table);
 }