Class TableSet
Represents a set of tables that are related to each other.
public class TableSet
- Inheritance
-
TableSet
- Inherited Members
- Extension Methods
Constructors
TableSet(string, SqlStore, MemTable, MemTable, List<MemTable>, TableSetFlags)
Constructor.
public TableSet(string ModuleName, SqlStore Store, MemTable ListTable, MemTable ItemTable, List<MemTable> Stocks, TableSetFlags Flags = TableSetFlags.GenerateSql)
Parameters
ModuleNamestringStoreSqlStoreListTableMemTableItemTableMemTableStocksList<MemTable>FlagsTableSetFlags
Properties
HideUntitledDisplayLabels
If true, then when SELECTing to a MemTable, hides any column not found in the table's Sqls.DisplayLabels.
public bool HideUntitledDisplayLabels { get; set; }
Property Value
LastCommitedId
Returns the Id of the last commit
public object LastCommitedId { get; }
Property Value
ModuleName
WARNING: The ModuleName and a TableName are used in constructing a unique StatementName.
The StatementName is used with the GetNativeSchemaFromTableName(string, string)
so the ModuleName.TableName must construct a unique name because schema DataTables are stored in the SqlCache under that unique name.
public string ModuleName { get; }
Property Value
Store
Returns the executor
public SqlStore Store { get; }
Property Value
Transaction
Returns the current Transaction
public DbTransaction Transaction { get; }
Property Value
Methods
AcceptChanges()
Cancels any pending edit operation in the whole table tree.
public void AcceptChanges()
Commit(bool)
Commits the whole table tree to the database. It can be either an insert or an update.
public object Commit(bool Reselect)
Parameters
Reselectbool
Returns
CommitBatch(BatchCommitArgs)
A Commit() version for batch operations.
Starts a transaction and keeps on calling BeforeFunc while AfterFunc returns true.
Commits the transaction each time the TransLimit is reached.
NOTE: BeforeFunc and AfterFunc are optional.
public void CommitBatch(BatchCommitArgs Args)
Parameters
ArgsBatchCommitArgs
Delete(object)
Deletes the whole table tree to the database. The way this method process table deletes, depends on the cascadeDeletes flag.
RowId could be string or integer and is the primary key value of the top table.
public void Delete(object RowId)
Parameters
RowIdobject
HasChanges()
Returns true if ItemTable table, or any of its details, in any depth, has changes.
public bool HasChanges()
Returns
ListCancel()
Cancel any pending edit operation in the ListTable.
public void ListCancel()
ListCancel(MemTable)
Cancel any pending edit operation in the Table.
public void ListCancel(MemTable Table)
Parameters
TableMemTable
ListSave()
Saves the ListTable to the database.
public void ListSave()
ListSave(MemTable)
Saves the Table to the database.
public void ListSave(MemTable Table)
Parameters
TableMemTable
ListSelect(string)
Executes the SELECT SqlText and puts the returned data rows to the ListTable.
public int ListSelect(string SqlText)
Parameters
SqlTextstring
Returns
ListSelect(MemTable, string)
Executes the SELECT SqlText and puts the returned data rows to the Table.
It is used when selecting for the List (browser) part of a data form.
Normally the Table passed to this method is not part of the table tree of the TableSet.
public int ListSelect(MemTable Table, string SqlText)
Parameters
Returns
Load(object)
Selects the whole table tree from the database starting from the top table (which is a single-row table).
RowId could be string or integer and is the primary key value of the top table.
public bool Load(object RowId)
Parameters
RowIdobject
Returns
PostChanges()
Posts any changes (deletes, updates, inserts) to the database
WARNING: Does NOT call AcceptChangesAll() on item table.
public void PostChanges()
ProcessCancel()
Cancels an edit operation and re-initializes the table tree.
WARNING: Does NOT call AcceptChangesAll() on item table.
public void ProcessCancel()
ProcessEmpty()
Removes all data rows from all tables in the tableTree
WARNING: Does NOT call AcceptChangesAll() on item table.
public void ProcessEmpty()
ProcessInsert()
Prepares the TableSet for an insert operation (in the tables, NOT the database)
WARNING: Does NOT call AcceptChangesAll() on item table.
public void ProcessInsert()
RejectChanges()
Rejects any pending edit operation in the whole table tree.
public void RejectChanges()
Events
TransactionStageCommit
Occurs when Commit(bool)() method is called.
public event EventHandler<TransactionEventArgs> TransactionStageCommit
Event Type
TransactionStageDelete
Occurs when Delete(object)(object RowId) method is called.
public event EventHandler<TransactionEventArgs> TransactionStageDelete