private TableSource CreateTableSource(TableInfo tableInfo, bool temporary)
{
lock (commitLock) {
try {
int tableId = NextTableId();
// Create the object.
var storeSystem = StoreSystem;
if (temporary)
storeSystem = tempStoreSystem;
var source = new TableSource(this, storeSystem, LargeObjectStore, tableId, tableInfo.TableName.FullName);
source.Create(tableInfo);
tableSources.Add(tableId, source);
if (!temporary) {
MarkUncommitted(tableId);
StateStore.Flush();
}
// And return it.
return source;
} catch (IOException e) {
throw new InvalidOperationException(String.Format("Unable to create source for table '{0}'.", tableInfo.TableName), e);
}
}
}