This content is outdated and is no longer being maintained. It is provided as a courtesy for individuals who are still using these technologies.
The ASP.NET ObjectDataSource Web server control provides a way to bind data controls on a Web page to an object. Typically, the object is a middle-tier business component. The control works with the middle-tier business object to declaratively select, insert, update, delete, page, sort, cache, and filter data without extensive code.
Figure 1 illustrates the typical process that occurs when ASP.NET processes a request for a Web page that contains an ObjectDataSource. The following are the steps in the illustrated process:
- The data-bound control interacts with the ObjectDataSource control to retrieve or modify data.
- The ObjectDataSource creates an instance of the source object.
- The ObjectDataSource control uses reflection to call the methods to select, update, insert, and delete data. The control passes values from the bound control to the business-tier object as parameters in the method calls.
- The business-tier object interacts with the underlying data source to retrieve or update data.
- The results are returned back to the data-bound control through the ObjectDataSource control.
- The ObjectDataSource control disposes the business-tier object.
When you use the ObjectDataSource control, the Web page initiates and controls the data retrieval and display.
|For more information about the ObjectDataSource control, see ObjectDataSource Web Server Control.|
The Web Client Software Factory reference implementation uses the Model-View-Presenter pattern. In this pattern, the presenter contains the logic to respond to user events (such as updating or retrieving data) and manipulates the state of the view. The ObjectContainerDataSource control implements data binding in a way that easily integrates with the Model-View-Presenter pattern.
You can think of the ObjectContainerDataSource control as a container of objects. You programmatically populate the container, and the container raises events when changes occur to any of the contained objects. This design allows the view (Web page) to delegate the responsibility of performing select operations, update operations, delete operations, and insert operations to the presenter. Figure 2 illustrates the request process for a view that uses the ObjectContainerDataSource control in an implementation of the Model-View-Presenter pattern.
The ObjectContainerDataSource also allows you to test views. This is because it provides a Model-View-Presenter for data binding. This means you can test what you bind.
For information on how to use the ObjectContainerDataSource control in your applications, see How to: Use the ObjectContainerDataSource Control.