System.Web.UI.WebControls.ObjectDataSourceView.ExecuteSelect Method

Retrieves data from the object that is identified by the ObjectDataSourceView.TypeName property by calling the method that is identified by the ObjectDataSourceView.SelectMethod property and passing any values in the ObjectDataSourceView.SelectParameters collection.

Syntax

protected override IEnumerable ExecuteSelect (System.Web.UI.DataSourceSelectArguments arguments)

Parameters

arguments
A System.Web.UI.DataSourceSelectArguments used to request operations on the data beyond basic data retrieval.

Returns

A IEnumerable list of data rows.

Remarks

The System.Web.UI.WebControls.ObjectDataSourceView class implements the inherited ObjectDataSourceView.ExecuteSelect(System.Web.UI.DataSourceSelectArguments) method to retrieve data using a business object. Page developers and data-bound control authors do not call the ObjectDataSourceView.ExecuteSelect(System.Web.UI.DataSourceSelectArguments) method directly; instead, use the publicly exposed erload:System.Web.UI.WebControls.ObjectDataSourceView.Select method.

The specified method can have any method signature, but must return one of the types for the System.Web.UI.WebControls.ObjectDataSource control that are listed in the following table to call it successfully.

IEnumerable

The IEnumerable is returned by the ObjectDataSourceView.Select(System.Web.UI.DataSourceSelectArguments) method.

System.Data.DataTable

A System.Data.DataView is created using the System.Data.DataTable and returned by the ObjectDataSourceView.Select(System.Web.UI.DataSourceSelectArguments) method.

System.Data.DataSet

The first System.Data.DataTable of the System.Data.DataSet is extracted and a System.Data.DataView is created and returned by the ObjectDataSourceView.Select(System.Web.UI.DataSourceSelectArguments) method.

object

The object is wrapped in a one-element IEnumerable and returned by the ObjectDataSourceView.Select(System.Web.UI.DataSourceSelectArguments) method.

Before the data retrieval is performed, the ObjectDataSourceView.OnSelecting(ObjectDataSourceSelectingEventArgs) method is called to raise the ObjectDataSourceView.Selecting event. You can handle this event to examine the values of the parameters and to perform any preprocessing before an operation.

To perform a select operation, the System.Web.UI.WebControls.ObjectDataSourceView control uses reflection to call the method that is identified by the ObjectDataSourceView.SelectMethod property and any associated parameters that are in the ObjectDataSourceView.SelectParameters collection, and then executes it. After the operation completes, the ObjectDataSourceView.OnSelected(ObjectDataSourceStatusEventArgs) method is called to raise the ObjectDataSourceView.Selected event. You can handle this event to examine any return values and error codes, and to perform any post-processing.

If the ObjectDataSourceView.Select(System.Web.UI.DataSourceSelectArguments) method returns a System.Data.DataSet object and caching is enabled, the System.Web.UI.WebControls.ObjectDataSourceView retrieves data from and saves data to the cache during the operation. The cache is created, discarded, or refreshed based on the caching behavior that is specified by the combination of the ObjectDataSource.CacheDuration and ObjectDataSource.CacheExpirationPolicy properties.

If the ObjectDataSourceView.Select(System.Web.UI.DataSourceSelectArguments) method returns a System.Data.DataSet object and a ObjectDataSourceView.FilterExpression property has been specified, it is evaluated along with any supplied ObjectDataSourceView.FilterParameters properties and the resulting filter is applied to the list of data during the erload:System.Web.UI.WebControls.ObjectDataSourceView.Select operation.

For information on returning the number of rows selected, see ObjectDataSourceView.Select(System.Web.UI.DataSourceSelectArguments).

Requirements

Namespace: System.Web.UI.WebControls
Assembly: System.Web (in System.Web.dll)
Assembly Versions: 2.0.0.0
Since: .NET 2.0