DataSourceSelectArguments 类

定义

提供一种机制,数据绑定控件可使用这种机制向数据源控件请求在检索数据之后执行与数据相关的操作。Provides a mechanism that data-bound controls use to request data-related operations from data source controls when data is retrieved. 此类不能被继承。This class cannot be inherited.

public ref class DataSourceSelectArguments sealed
public sealed class DataSourceSelectArguments
type DataSourceSelectArguments = class
Public NotInheritable Class DataSourceSelectArguments
继承
DataSourceSelectArguments

注解

数据绑定控件使用DataSourceSelectArguments类请求数据源控件对结果集执行与数据相关的其他操作, 例如, 对数据进行排序或返回特定的数据子集。Data-bound controls use the DataSourceSelectArguments class to request that a data source control performs additional data-related operations on a result set, such as sorting the data or returning a specific subset of data. 这些与数据相关的操作通过DataSourceCapabilities枚举枚举。These data-related operations are enumerated by the DataSourceCapabilities enumeration. 下表指示DataSourceSelectArguments类如何支持这些与数据相关的操作。The following table indicates how the DataSourceSelectArguments class supports these data-related operations.

功能Capability 相关 DataSourceSelectArguments 属性Related DataSourceSelectArguments properties
DataSourceCapabilities.Sort SortExpression
DataSourceCapabilities.Page StartRowIndexMaximumRowsStartRowIndex, MaximumRows
DataSourceCapabilities.RetrieveTotalRowCount RetrieveTotalRowCountTotalRowCountRetrieveTotalRowCount, TotalRowCount

数据绑定控件显式调用PerformSelect方法来绑定数据, 这将Select(DataSourceSelectArguments, DataSourceViewSelectCallback)调用与它们关联的数据源控件的方法。Data-bound controls explicitly call the PerformSelect method to bind data, which calls the Select(DataSourceSelectArguments, DataSourceViewSelectCallback) method of the data source control they are associated with. 通过这种方式, 数据绑定控件按需从数据源控件检索数据。In this way, the data-bound control retrieves data from the data source control on demand. 由于方法接受参数, 因此数据绑定控件负责创建DataSourceSelectArguments和管理对象, 并在从数据源控件检索数据时将Select(DataSourceSelectArguments, DataSourceViewSelectCallback)该对象传递给方法。 DataSourceSelectArguments Select(DataSourceSelectArguments, DataSourceViewSelectCallback)Because the Select(DataSourceSelectArguments, DataSourceViewSelectCallback) method accepts a DataSourceSelectArguments parameter, the data-bound control is responsible for creating and managing a DataSourceSelectArguments object and passing it to the Select(DataSourceSelectArguments, DataSourceViewSelectCallback) method when it retrieves data from the data source control.

在某些情况下, 数据绑定控件可能不需要任何其他数据相关功能。In some cases, data-bound controls might not need any additional data-related capabilities. 在这种情况下, 数据绑定控件Empty Select(DataSourceSelectArguments, DataSourceViewSelectCallback)将参数对象传递给方法。In this case, data-bound controls pass an Empty arguments object to the Select(DataSourceSelectArguments, DataSourceViewSelectCallback) method.

对于排序的结果集, 数据绑定控件CanSort DataSourceCapabilities.Sort将在运行时检查数据源视图的属性, 并使用AddSupportedCapabilities(DataSourceCapabilities)方法添加功能。For sorted result sets, data-bound controls check a data source view's CanSort property at run time, and add a DataSourceCapabilities.Sort capability using the AddSupportedCapabilities(DataSourceCapabilities) method. 作为一个单独的操作, 数据绑定控件可以通过对传递给SortExpression Select(DataSourceSelectArguments, DataSourceViewSelectCallback)方法的DataSourceSelectArguments对象设置属性, 从数据源控件请求排序的结果集。As a separate operation, the data-bound control can request a sorted result set from a data source control by setting the SortExpression property on the DataSourceSelectArguments object passed to the Select(DataSourceSelectArguments, DataSourceViewSelectCallback) method.

对于分页方案, 数据绑定控件CanPage DataSourceCapabilities.Page将在运行时检查数据源视图的属性, 并使用AddSupportedCapabilities(DataSourceCapabilities)方法添加功能。For paging scenarios, data-bound controls check a data source view's CanPage property at run time, and add a DataSourceCapabilities.Page capability using the AddSupportedCapabilities(DataSourceCapabilities) method. 作为单独的操作, 数据绑定控件可以通过设置StartRowIndex传递给Select(DataSourceSelectArguments, DataSourceViewSelectCallback)方法的DataSourceSelectArguments对象的和MaximumRows属性, 从数据源控件请求数据的子集进行分页。As a separate operation, the data-bound control can request a subset of data from a data source control for paging by setting the StartRowIndex and MaximumRows properties on the DataSourceSelectArguments object passed to the Select(DataSourceSelectArguments, DataSourceViewSelectCallback) method.

若要检索分页方案的总行数, 数据绑定控件CanRetrieveTotalRowCount DataSourceCapabilities.RetrieveTotalRowCount将在运行时检查数据源视图的属性, 并使用AddSupportedCapabilities(DataSourceCapabilities)方法添加功能。To retrieve a total row count for paging scenarios, data-bound controls check a data source view's CanRetrieveTotalRowCount property at run time, and add a DataSourceCapabilities.RetrieveTotalRowCount capability using the AddSupportedCapabilities(DataSourceCapabilities) method. 作为一个单独的操作, 数据绑定控件可以通过对传递给RetrieveTotalRowCount Select(DataSourceSelectArguments, DataSourceViewSelectCallback)方法的DataSourceSelectArguments对象设置属性, 从数据源控件请求汇总行计数。As a separate operation, the data-bound control can request a total row count from a data source control for paging by setting the RetrieveTotalRowCount property on the DataSourceSelectArguments object passed to the Select(DataSourceSelectArguments, DataSourceViewSelectCallback) method. 当该Select(DataSourceSelectArguments, DataSourceViewSelectCallback)方法返回时, TotalRowCount由属性包含总行数。When the Select(DataSourceSelectArguments, DataSourceViewSelectCallback) method returns, the total row count is contained by the TotalRowCount property.

重要

如果设置了DataSourceSelectArguments任何属性, 但当前绑定的数据源控件不支持所请求的功能InvalidOperationException , 则调用DataSourceSelectArguments.RaiseUnsupportedCapabilitiesError(DataSourceView)方法时将引发异常。If any of the DataSourceSelectArguments properties are set, but the currently bound data source control does not support the requested capability, an InvalidOperationException exception is thrown when the DataSourceSelectArguments.RaiseUnsupportedCapabilitiesError(DataSourceView) method is called.

构造函数

DataSourceSelectArguments()

初始化 DataSourceSelectArguments 类的新默认实例。Initializes a new default instance of the DataSourceSelectArguments class.

DataSourceSelectArguments(Int32, Int32)

使用要为分页方案返回的起始位置和行数初始化 DataSourceSelectArguments 类的新实例。Initializes a new instance of the DataSourceSelectArguments class with the specified starting position and number of rows to return for paging scenarios.

DataSourceSelectArguments(String)

使用指定的排序表达式初始化 DataSourceSelectArguments 类的新实例。Initializes a new instance of the DataSourceSelectArguments class with the specified sort expression.

DataSourceSelectArguments(String, Int32, Int32)

使用要为分页方案返回的指定排序表达式、起始位置和行数初始化 DataSourceSelectArguments 类的新实例。Initializes a new instance of the DataSourceSelectArguments class with the specified sort expression, starting position, and number of rows to return for paging scenarios.

属性

Empty

获取一个排序表达式设置为 DataSourceSelectArgumentsEmpty 对象。Gets a DataSourceSelectArguments object with the sort expression set to Empty.

MaximumRows

获取或设置一个值,该值表示在一次数据检索操作中,数据源控件返回的最大数据行数。Gets or sets a value that represents the maximum number of data rows that a data source control returns for a data retrieval operation.

RetrieveTotalRowCount

获取或设置一个值,该值指示在数据检索操作过程中,数据源控件是否应检索所有数据行的计数。Gets or sets a value indicating whether a data source control should retrieve a count of all the data rows during a data retrieval operation.

SortExpression

获取或设置一个表达式,数据源视图使用该表达式对 Select(DataSourceSelectArguments, DataSourceViewSelectCallback) 方法检索的数据进行排序。Gets or sets an expression that the data source view uses to sort the data retrieved by the Select(DataSourceSelectArguments, DataSourceViewSelectCallback) method.

StartRowIndex

获取或设置一个值,该值表示在数据检索操作过程中,检索数据行时数据源控件应使用的起始位置。Gets or sets a value that represents the starting position the data source control should use when retrieving data rows during a data retrieval operation.

TotalRowCount

获取或设置在数据检索操作过程中检索的行数。Gets or sets the number of rows retrieved during a data retrieval operation.

方法

AddSupportedCapabilities(DataSourceCapabilities)

DataSourceSelectArguments 实例添加一个功能,用于对支持的功能和请求的功能进行比较。Adds one capability to the DataSourceSelectArguments instance, which is used to compare supported capabilities and requested capabilities.

Equals(Object)

确定指定的 DataSourceSelectArguments 实例是否等于当前实例。Determines whether the specified DataSourceSelectArguments instance is equal to the current instance.

GetHashCode()

返回 DataSourceSelectArguments 类型的哈希代码。Returns the hash code for the DataSourceSelectArguments type.

GetType()

获取当前实例的 TypeGets the Type of the current instance.

(继承自 Object)
MemberwiseClone()

创建当前 Object 的浅表副本。Creates a shallow copy of the current Object.

(继承自 Object)
RaiseUnsupportedCapabilitiesError(DataSourceView)

将为 ExecuteSelect(DataSourceSelectArguments) 操作请求的功能与指定的数据源视图所支持的功能进行比较。Compares the capabilities requested for an ExecuteSelect(DataSourceSelectArguments) operation against those that the specified data source view supports.

ToString()

返回表示当前对象的字符串。Returns a string that represents the current object.

(继承自 Object)

适用于

另请参阅