Design Time integration
A DataSourceControl performs two main tasks at design time:
- Provide a configuration dialog to quickly configure the data source.
- Provide type schema information to the control using the data source in order to populate field
pickers and to generate default templates based on the schema.
- The previous point forces us save the total row count to return it later, so the Select method could not be static.
The configuration wizard exposed by the CompatObjectDataSource is shown here:
The configuration wizard exposed by the ExtendedObjectDataSource is shown here:
As you can see the wizard lets us configure the methods called by data source controls in an easy way
with just a few clicks and it also provides support to configure paging, sorting, filtering and optimistic
concurrency.
The configuration wizard has an option to avoid persisting the paging, sorting and filtering parameters
in the SelectParameters collection. This is because some times, those parameters are filled
automatically by the control using the data source (for example, a GridView) and will
be added automatically by the data source control when calling the SelectMethod. If you
are using the CompatObjectDataSource, the SelectCountMethod will be called
with the parameters persisted in the SelectParameters collection so if the paging parameters
are persisted, the SelectCountMethod will need two parameters that probably it will not use.
That's why there is an option to remove those parameters from the resulting collection.
The CompatObjectDataSource and the ExtendedObjectDataSource also
provide type schema information to the controls using them as their data source. Because of that, the
controls using those data sources can provide schema information and generate templates based on the
schema information provided by the data source control as the next image shows:

The CompatObjectDataSource and the ExtendedObjectDataSource
have full design time support for generics, and also work with interfaces and types
stored in the Global Assembly Cache.
|