Export (0) Print
Expand All

ObjectContainerDataSource Control

Retired Content

This content is outdated and is no longer being maintained. It is provided as a courtesy for individuals who are still using these technologies.
This page may contain URLs that were valid when originally published, but now link to sites or pages that no longer exist.

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:

  1. The data-bound control interacts with the ObjectDataSource control to retrieve or modify data.
  2. The ObjectDataSource creates an instance of the source object.
  3. 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.
  4. The business-tier object interacts with the underlying data source to retrieve or update data.
  5. The results are returned back to the data-bound control through the ObjectDataSource control.
  6. The ObjectDataSource control disposes the business-tier object.

Ff709905.ad8436c4-2f9a-4274-9903-64fd6f73a145(en-us,PandP.10).png

Figure 18

Typical request process for the ASP.NET ObjectDataSource control

When you use the ObjectDataSource control, the Web page initiates and controls the data retrieval and display.

Ff709905.note(en-us,PandP.10).gifNote:
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.

Ff709905.473406a1-eb23-48f3-8b93-d9995d749961(en-us,PandP.10).png

Figure 19

Request process for the ObjectContainerDataSource control

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.

Show:
© 2014 Microsoft