Table of Contents

Class TableSet

Namespace
Tripous.Data
Assembly
Tripous.Data.dll

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

ModuleName string
Store SqlStore
ListTable MemTable
ItemTable MemTable
Stocks List<MemTable>
Flags TableSetFlags

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

bool

LastCommitedId

Returns the Id of the last commit

public object LastCommitedId { get; }

Property Value

object

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

string

Store

Returns the executor

public SqlStore Store { get; }

Property Value

SqlStore

Transaction

Returns the current Transaction

public DbTransaction Transaction { get; }

Property Value

DbTransaction

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

Reselect bool

Returns

object

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

Args BatchCommitArgs

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

RowId object

HasChanges()

Returns true if ItemTable table, or any of its details, in any depth, has changes.

public bool HasChanges()

Returns

bool

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

Table MemTable

ListSave()

Saves the ListTable to the database.

public void ListSave()

ListSave(MemTable)

Saves the Table to the database.

public void ListSave(MemTable Table)

Parameters

Table MemTable

ListSelect(string)

Executes the SELECT SqlText and puts the returned data rows to the ListTable.

public int ListSelect(string SqlText)

Parameters

SqlText string

Returns

int

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

Table MemTable
SqlText string

Returns

int

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

RowId object

Returns

bool

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

EventHandler<TransactionEventArgs>

TransactionStageDelete

Occurs when Delete(object)(object RowId) method is called.

public event EventHandler<TransactionEventArgs> TransactionStageDelete

Event Type

EventHandler<TransactionEventArgs>