ComponentOne DataObjects for .NET
Creating and Modifying a Data Set Definition
DataObjects for .NET (Enterprise Edition) > Schema Objects > Data Sets > Creating and Modifying a Data Set Definition

To create a data set, open the Schema Designer and select View | DataSets. In the DataSets window, press the Add button or select Add from the context menu. The empty new data set will open as a new DataSet Editor page.


The DataSet Editor Diagram looks similar to the Diagram tab of the Composite Table Editor – it contains a diagram (graph) of table views connected with relations. It also allows you to set the properties of the graph's nodes: TableView and ViewRelation objects. Unlike the Composite Table Editor, it also allows you to set the properties of table view fields (TableViewField objects).

Immediately after creating a new data set, you can rename it by renaming the DataSet node in the DataSets window.

The first action when setting up a data set is creating table views and adding them to the diagram. Table views can be added to the diagram by clicking the Add tables button in the DataSet Editor Diagram. The Add tables dialog box appears.


Select tables from the list of Existing tables and use the arrows to move them to the list of Selected tables.

Table views can also be added by dragging and dropping them from the Tables window onto the Diagram of the DataSet Editor.

When you add a table view to the diagram, relevant relations connecting it to other table views in the diagram are also added, unless suppressed by unchecking the "Create view relations" check box in the Add tables dialog box or by unchecking the "Automatically create relations adding tables to diagrams" check box in the Options dialog box (select Optionsin the Schema menu). Redundant relations can then be deleted by selecting a relation arrow in the diagram and pressing the Delkey or by right-clicking the relationship and selecting Remove from the context menu.


You can also add tables using the Table button on the top bar of the Diagram. Simply click the Table button, then click the diagram, and the table is added. In this case, you will have to set the Table property manually, selecting the newly created table view and setting its Table property in the property grid below the diagram.


It is also possible to add relations to the diagram manually. Click the Relation button on the top bar of the Diagram and draw an arrow connecting parent and child tables using drag-and-drop from parent to child. The Schema Designer will try to find an appropriate relation connecting these two tables (inverting the relation, if necessary). When the new view relation is created, select it and look at popup box or the value of the Relation property in the property grid below the diagram. If this property is empty, it means that the Schema Designer could not find an appropriate relation.


The objects shown on the diagram are TableView and ViewRelation objects. See Table Views and View Relations for detailed descriptions. To set properties of any object on the diagram, including table views, table view fields and view relations, select the object on the diagram and browse/set its properties in the property grid below the diagram. To select a view relation, select the arrow representing the view relation. If it represents multiple view relations, you will need to choose one of them from a context menu that pops up when you select the arrow. To select a table view field, select an item in the list of fields shown inside a table view.

By default, when you add a table view, its Fields collection is filled with all fields of the corresponding table. More exactly, since TableViewField and TableField are different objects, it means that the table view contains a TableViewField representing each TableField of the corresponding table.

If you need to add a table view field (for example, a calculated, unbound field, see Table View Fields), or delete some table view fields or re-arrange their order, right-click the table view and select Fields from the context menu. In the Fields dialog box you can also set properties of table view fields, although that can be done in the diagram too, in the property grid below the diagram.


If you want to restore the collection of table view fields to its initial state, as if the table view has just been added to the diagram, right-click the table view and select Retrieve Fields from the context menu. This will create TableViewField objects anew, one table view field for each table field.