internal ITransaction CreateTransaction(IsolationLevel isolation)
{
var thisCommittedTables = new List<TableSource>();
// Don't let a commit happen while we are looking at this.
lock (commitLock) {
int thisCommitId = CurrentCommitId;
var committedTableList = StateStore.GetVisibleList();
thisCommittedTables.AddRange(committedTableList.Select(resource => GetTableSource(resource.TableId)));
// Create a set of IIndexSet for all the tables in this transaction.
var indexInfo = (thisCommittedTables.Select(mtable => mtable.CreateIndexSet())).ToList();
// Create a context for the transaction to handle the isolated storage of variables and services
var context = DatabaseContext.CreateTransactionContext();
// Create the transaction and record it in the open transactions list.
return new Transaction(context, Database, thisCommitId, isolation, thisCommittedTables, indexInfo);
}
}