/// <summary> /// 从基础数据存储获取数据列表。 /// </summary> /// <param name="arguments"></param> /// <returns></returns> protected internal abstract IEnumerable ExecuteSelect(DataSourceSelectArgumentsEx arguments);
/// <summary> /// 从基础数据存储中异步获取数据列表。 /// </summary> /// <param name="arguments">用于请求对数据执行基本数据检索以外的操作。</param> /// <param name="callback">用于在异步操作完成时通知数据绑定控件的 <see cref="DataSourceViewSelectCallback"/> 委托。</param> public virtual void Select(DataSourceSelectArgumentsEx arguments, DataSourceViewSelectCallback callback) { if (callback == null) throw new ArgumentNullException("callback"); callback(this.ExecuteSelect(arguments)); }
/// <summary> /// 创建 <see cref="DataSourceSelectArgumentsEx"/> 对象,该对象包含传递到数据源进行处理的参数。 /// </summary> /// <returns></returns> protected override DataSourceSelectArgumentsEx CreateDataSourceSelectArguments() { DataSourceSelectArgumentsEx arguments = new DataSourceSelectArgumentsEx(); DataSourceViewEx data = this.GetData(); string sortExpressionInternal = this.SortExpression; if ((this.SortDirection == SortDirection.Descending) && !string.IsNullOrEmpty(sortExpressionInternal)) sortExpressionInternal += " DESC "; arguments.SortExpression = sortExpressionInternal; if (this.AllowPaging && data.CanPage) { if (data.CanRetrieveTotalRowCount) { arguments.RetrieveTotalRowCount = true; arguments.MaximumRows = this.PageSize; } else arguments.MaximumRows = -1; arguments.StartRowIndex = this.PageSize * this.PageIndex; } return arguments; }
/// <summary> /// /// </summary> /// <param name="arguments"></param> /// <returns></returns> protected internal override IEnumerable ExecuteSelect(DataSourceSelectArgumentsEx arguments) { //arguments.RaiseUnsupportedCapabilitiesError(this); return this.dataSource; }
/// <summary> /// 从关联的数据源中检索数据。 /// </summary> protected override void PerFormSelect() { this.OnDataBinding(EventArgs.Empty); DataSourceViewEx data = this.GetData(); this.arguments = this.CreateDataSourceSelectArguments(); this.ignoreDataSourceViewChanged = true; base.RequiresDataBinding = false; this.MarkAsDataBound(); data.Select(this.arguments, new DataSourceViewSelectCallback(this.OnDataSourceViewSelectCallback)); }