private LocalTable <T> GetCurrentTransactionTable <T>(TupleType type) { if (_transactionCount == 0) { return(_space.GetRootTable <T>(type)); } // transactions have their own tables for (var i = 0; i < _transactionTablesCount; i++) { if (_transactionTables[i].TupleTypeId != type.Id) { continue; } var table = (LocalTable <T>)_transactionTables[i].Table; if (table.HierarchyLevel == _transactionCount) { return(table); } // create nested table var nestedTable = LocalTable <T> .GetTransactional(_transactionCount, table); _transactionTables[i].Table = nestedTable; return(nestedTable); } // nothing found var newNestedTable = LocalTable <T> .GetTransactional(_transactionCount, _space.GetRootTable <T>(type)); if (_transactionTablesCount == _transactionTables.Length) { // resize _transactionTables Array.Resize(ref _transactionTables, _transactionTablesCount * 2); } _transactionTables[_transactionTablesCount++] = new TransactionTableHolder(type.Id, newNestedTable); return(newNestedTable); }
public void BeginTransaction() { _transactionCount++; if (_transactionTables == null) { _transactionTables = new TransactionTableHolder[LocalSpaceConsts.ProxyTableTransactionsCapacity]; } }