ComponentOne ADO.NET DataExtender
In This Topic
    Working with C1DataViewSet
    In This Topic

    A single C1DataViewSet component on a Form represents a set of data views based on DataTables from an ADO.NET dataset, with master-details relationships between them. The C1DataViewSet component also provides clear navigational and data changing event handlers for each view defined in a view set. Additionally, it performs automatic data fetching and committing, or updating, to a server in only one method call. This approach makes the Form's data model definition and data manipulation highly manageable and easy to use.

    To define a data model used in a Form, you have to add a C1DataViewSet component to a Form and choose one of the following data sources:

    After defining a data source, you must define a set of data views, or C1DataView objects, which can be done using the C1ViewSetDesignerForm.

    C1DataView is a customized view of a DataTable, either single, multiple, or joined tables, designed for UI controls for binding, sorting, filtering, searching, navigating, and editing. Each C1DataView object can represent data from either a single table of a data source (simple view) or from a row set constructed as a join of multiple tables from a data source (composite view), similar to a SQL server view.

    C1DataView objects can be connected with master-detail relationships between them, which provide detail views with automatic child row filtering and foreign key inheritance.

    A UI control can then be bound to a specific C1DataView of a C1DataViewSet by setting its DataSource property to the C1DataViewSet and setting its DataMember property to the C1DataView name.

    C1DataViewSet also provides events that allow custom processing of row navigation and data changing occurrences in each individual C1DataView.

    Once a C1DataView object has been specified within a C1DataViewSet, you can run the program. In the following example, the Form contains a grid bound to a C1DataView object that represents the Orders DataTable from a typed dataset.


    The data is automatically fetched from the server for the C1DataView; no special effort is required. After the user makes corrections to the client data, the changes made in the C1DataView, or multiple C1DataViews, can be committed to a database server with a single method call. When performing database updates, C1DataViewSet takes into account the types of corrections performed on data rows and the interrelations between data tables in order to commit data rows in the correct order, thus preventing possible conflicts on a server. As a part of the database updating process, C1DataViewSet retrieves auto-generated primary key values (and additional row values which may be changed on the server) back to the client rows, and correctly updates the foreign key values of child rows.

    See Also