本文整理汇总了C#中ITransaction.UpdateVisibleTable方法的典型用法代码示例。如果您正苦于以下问题:C# ITransaction.UpdateVisibleTable方法的具体用法?C# ITransaction.UpdateVisibleTable怎么用?C# ITransaction.UpdateVisibleTable使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ITransaction
的用法示例。
在下文中一共展示了ITransaction.UpdateVisibleTable方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: FindChangedTables
private ITable[] FindChangedTables(ITransaction checkTransaction, CommitTableInfo[] normalizedChangedTables)
{
var changedTableSource = new ITable[normalizedChangedTables.Length];
// Set up the above arrays
for (int i = 0; i < normalizedChangedTables.Length; ++i) {
// Get the information for this changed table
CommitTableInfo tableInfo = normalizedChangedTables[i];
// Get the master table that changed from the normalized list.
TableSource master = tableInfo.Master;
// Did this table change since the transaction started?
TableEventRegistry[] allTableChanges = tableInfo.ChangesSinceCommit;
if (allTableChanges == null || allTableChanges.Length == 0) {
// No changes so we can pick the correct IIndexSet from the current
// transaction.
// Get the state of the changed tables from the Transaction
var mtable = Transaction.GetMutableTable(master.TableName);
// Get the current index set of the changed table
tableInfo.IndexSet = Transaction.GetIndexSetForTable(master);
// Flush all index changes in the table
mtable.FlushIndexes();
// Set the 'check_transaction' object with the latest version of the
// table.
checkTransaction.UpdateVisibleTable(tableInfo.Master, tableInfo.IndexSet);
} else {
// There were changes so we need to merge the changes with the
// current view of the table.
// It's not immediately obvious how this merge update works, but
// basically what happens is we WriteByte the table journal with all the
// changes into a new IMutableTableDataSource of the current
// committed state, and then we flush all the changes into the
// index and then update the 'check_transaction' with this change.
// Create the IMutableTableDataSource with the changes from this
// journal.
var mtable = master.CreateTableAtCommit(checkTransaction, tableInfo.Journal);
// Get the current index set of the changed table
tableInfo.IndexSet = checkTransaction.GetIndexSetForTable(master);
// Flush all index changes in the table
mtable.FlushIndexes();
// Dispose the table
mtable.Dispose();
}
// And now refresh the 'changedTableSource' entry
changedTableSource[i] = checkTransaction.GetTable(master.TableName);
}
return changedTableSource;
}