ComponentOne DataObjects for .NET
Table Views
DataObjects for .NET (Enterprise Edition) > Schema Objects > Table Views

A TableView object represents a table in a data set. It can represent a simple or a composite table. The table is determined by its Table property.

TableView also has properties of its own. Some TableView properties can be used to override table properties. For example, you can set ReadOnly to True, which will make the table view read-only, although the table itself may be modifiable. The following TableView properties override Table properties: AllowAddNew, AllowDelete, ReadOnly.

Other TableView properties work independently of or in addition to Table properties:

The PrimaryKey property is read-only. It shows the field name(s) constituting the primary key of the table on which the table view is based. Multiple field names are separated with commas. A table view's primary key is the same as the corresponding table's primary key. The only purpose of having a special PrimaryKey property in TableView is that table view field names can differ from table field names, so the string value may not be the same. Note that primary key table fields are always represented by table view fields, such table view fields are not allowed to be deleted. This insures that each table view has proper primary key.

The FillSort property controls the order in which data rows are sorted after fetch. The order can also be specified at run time, calling Fill method, by specifying FillSort in a FilterCondition. By default, fetched data is sorted by primary key. If a different sort is required, set the FillSort property to the sort field name(s). To specify sort order (ascending/descending), add "ASC" (ascending) or "DESC" (descending) after the field name. If no order is specified, the order is "ASC" (ascending). Multiple field names are separated with commas.

Example: "CustomerID DESC, OrderID".

ConstraintsFieldLevel and ConstraintsRecordLevel are collections of table view constraints, ConstraintInfo objects. Constraints are expressions, see DataObjects for .NET Expressions. These constraints are tested in addition to table constraints when data is modified in this table view, see Table Properties. If you have a constraint that must always be enforced for a given table, must be satisfied in all table views representing that table, put it in the table's constraint collection. If, on the other hand, you have a constraint that is specific to a particular table view, then it belongs to the table view's constraint collection.

ConstraintsRecordLevel contains record level constraints that are evaluated when the user finishes editing a row, before the C1DataSetLogic BeforeEndEdit event. If one of the constraints is not satisfied, an exception is thrown. The exception message is determined by ErrorDescription. Constraints with Condition expression (if non-empty) evaluating to False, are skipped, and not tested.

ConstraintsFieldLevel contains field level constraints that are evaluated on every field change made in this table view. Usually, a field level constraint belongs to a certain field, not to the table view as a whole, in which case it resides in Constraints. ConstraintsFieldLevel should contain only field level constraints that cannot be associated with a particular field. Constraints in ConstraintsFieldLevel are evaluated each time any table view field changes, whereas constraints in Constraints are evaluated on the owner field change.

The AutoEndAddNew property determines behavior of newly added rows. If it is set to True (default), setting the row's primary key triggers adding the new row to the table. If it is set to False, the newly added row is considered temporary, not belonging to the table, until the EndAddNew method is explicitly called.

The DataAccessMode property determines whether the table view functions in virtual mode, and specifies which of the three possible virtual modes is used. DataObjects for .NET virtual mode allows you to use large datasets in .NET Windows Forms applications, a feature that is not supported in Visual Studio and ADO.NET without DataObjects for .NET. In virtual mode, data retrieval occurs in limited chunks of data, upon request, instead of pre-fetching all data at once. See Tutorial 4 for more details.

The following options are available for the DataAccessMode:

The following properties are performance tuning settings for virtual mode, must be changed only if default values are unsatisfactory: VirtualAsyncThreshold, VirtualConsolidateRows, VirtualSegmentCount, VirtualSegmentSize, and VirtualSyncThreshold; see Tutorial 4 for more information.

See Also