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); } }
internal void EndTransaction() { //FreeTable(_editTransactionEntityCursor); //release the cursor back to the pool InstanceCache.EndCaching(); _editTransactionEntityCursor.Dispose(); _editTransactionEntityCursor = null; }
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; }
public XbimInstancesEntityEnumerator(PersistedEntityInstanceCache cache) { this.cache = cache; cursor = cache.GetEntityTable(); Reset(); }
/// <summary> /// Returns the table to the cache for reuse /// </summary> /// <param name="table"></param> public void FreeTable(EsentEntityCursor table) { InstanceCache.FreeTable(table); }