ComponentOne DataObjects for .NET
Data Sets
DataObjects for .NET (Enterprise Edition) > Schema Objects > Data Sets

A C1DataSet is a self-contained data and code unit filled with data according to the schema. It is the data as it is exposed to the user, which can be used both by data bound controls and programmatically. Any DataObjects for .NET client works with a C1DataSet. A data set also serves as a transaction context; modifications made in separate data sets belong to separate transactions. Modifications are not visible across data sets.

The structure of a data set is defined in the schema as a DataSetDef object. A schema can contain multiple data set definitions.

To fill a C1DataSet with data, you can either explicitly call Fill from code or set FillOnRequest property to True (the default value), making a data set fetch data at startup, when the data is requested.

When filling a data set with data, you must be aware that unless you specify filter conditions in code before calling Fill or in BeforeFill event, each table view will fetch all existing table data unrestricted. To restrict fetch, you must specify filter conditions for each table view separately. Restricting one table view does not automatically restrict any other.

All data fetched for a C1DataSet object are retrieved in one call to the server, a Fill call, unless in virtual mode where data retrieval occurs in limited chunks of data, upon request, see Tutorial 4: Virtual Mode: Dealing with Large Datasets. The user application can then make modifications to the data in a C1DataSet locally, and send modifications to the data source (usually, a database) calling Update, or automatically, using a C1DataTableSource with UpdateLeavingRow property set to True.

A data set is a collection of table views (TableView objects) optionally connected with view relations (ViewRelation objects). Each table view represents a certain table, either simple or complex. There can be multiple table views representing a single table in a data set. It is most common for a table view to represent a table without changing anything, without modifying business logic and properties, and with table view fields exactly corresponding to the table fields. In this case, creating a data set definition in the Schema Designer is a simple matter of selecting tables that need to be represented by the data set (use the Add Tables button). However, in more advanced cases you can use the ability of a table view to override and modify the table's business logic and properties, and customize table view fields, see Table Views.

The set of table views you include in a data set determines what tables are filled with data in this data set. It is the developer's responsibility that all tables that are used by business logic code of a data set are present in the data set, otherwise an exception may occur when the code tries to access tables that have not been fetched. See How the Data is Fetched for details.

See Also