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

    Typed ADO.NET dataset provides a set of properties for constituting DataTables and their DataColumns, which are propagated by C1DataViewSet to its C1DataViews and C1ViewColumns. For example, DataColumn.ReadOnly is used as a default value for the ReadOnly property of a column that is based on the corresponding DataColumn.

    However, C1DataViews and their constituting C1ViewColumn objects provide an extended set of properties (compared to an ADO.NET DataTable and DataColumn, which are not necessary, but useful for some properties) when defining them one time in one single place, similar to what is done for typed dataset properties.

    Such a place is provided by ADO.NET DataExtender and is called DataSetExtender. DataSetExtender provides storage for specifying an extended set of property values for the specific typed dataset. For example, DataSetExtender represents DataTable and DataColumn related properties which are not defined on these classes, but which C1DataViewSet would like to have and is capable of consuming. The core class that represents DataSetExtender is DataSetExtender.

    Creating a DataSetExtender

    To create a DataSetExtender, perform the following tasks:

    1. Select Add New Item from the Project menu in Visual Studio. Alternatively, right-click the project node in the Solution Explorer and select Add | New Item from its context menu.

      The Add New Item window appears.


    2. Select DataSet Extender for the dataset, enter a name for the DataSetExtender in the Name text box, and click Add.

      The DataSetExtender is created as a global project item, similar to typed ADO.NET dataset, and its designer appears in a separate window of the VS IDE.

    3. From the Properties window, set the DataSetExtender.DataSet property value to an existing typed ADO.NET dataset within the project.

      The DataSetExtender represents an additional set of properties for this dataset. The DataSetExtender automatically creates all items representing DataTable and DataColumn objects from the specified typed dataset, and will keep them in sync when they are updated in the future. For instance, if you add a new DataTable or DataColumn to the typed dataset a corresponding item is automatically created in DataSetExtender the next time you open its designer.

    To set the properties for one of the items listed in the DataSetExtender:

    1. Select an item which represents either a table or column in the DataSetExtender designer.
    2. Modify its properties through the Visual Studio Properties window.

    To apply DataSetExtender property values to a certain C1DataViewSet component:

    1. Select one of the C1DataViewSet components on the form.
    2. Set the C1DataViewSet.SchemaExtender property to the name of the DataSetExtender in the Visual Studio Properties window. Note that you have to rebuild your project for the name of the DataExtender to appear in the C1DataViewSet.SchemaExtender drop-down list.
    See Also