2 // System.Web.UI.DataSourceSelectArguments.cs
5 // Sanjay Gupta <gsanjay@novell.com>
7 // (C) 2004 Novell, Inc (http://www.novell.com)
11 // Permission is hereby granted, free of charge, to any person obtaining
12 // a copy of this software and associated documentation files (the
13 // "Software"), to deal in the Software without restriction, including
14 // without limitation the rights to use, copy, modify, merge, publish,
15 // distribute, sublicense, and/or sell copies of the Software, and to
16 // permit persons to whom the Software is furnished to do so, subject to
17 // the following conditions:
19 // The above copyright notice and this permission notice shall be
20 // included in all copies or substantial portions of the Software.
22 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
23 // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
24 // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
25 // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
26 // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
27 // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
28 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
34 namespace System.Web.UI
36 public sealed class DataSourceSelectArguments
38 string sortExpression = string.Empty;
39 int startingRowIndex = 0;
41 bool getTotalRowCount = false;
42 int totalRowCount = -1;
43 DataSourceCapabilities dsc = DataSourceCapabilities.None;
45 static DataSourceSelectArguments empty = new DataSourceSelectArguments();
46 public static DataSourceSelectArguments Empty {
52 public DataSourceSelectArguments ()
56 public DataSourceSelectArguments (string sortExpression)
58 this.sortExpression = sortExpression;
61 public DataSourceSelectArguments (int startingRowIndex, int maxRows)
63 this.startingRowIndex = startingRowIndex;
64 this.maxRows = maxRows;
67 public DataSourceSelectArguments (string sortExpression, int startingRowIndex, int maxRows)
69 this.sortExpression = sortExpression;
70 this.startingRowIndex = startingRowIndex;
71 this.maxRows = maxRows;
74 public void AddSupportedCapabilities (DataSourceCapabilities srcCapabilities)
76 this.dsc = this.dsc | srcCapabilities;
79 public override bool Equals (object obj)
81 if (!(obj is DataSourceSelectArguments))
84 DataSourceSelectArguments args = (DataSourceSelectArguments)obj;
85 return (this.sortExpression == args.sortExpression &&
86 this.startingRowIndex == args.startingRowIndex &&
87 this.maxRows == args.maxRows);
91 public override int GetHashCode ()
93 return sortExpression.GetHashCode ();
96 public void RaiseUnsupportedCapabilitiesError (DataSourceView view)
98 view.RaiseUnsupportedCapabilityError (this.dsc);
101 public int MaximumRows {
102 get { return this.maxRows; }
104 this.maxRows = value;
108 public bool RetrieveTotalRowCount {
109 get { return this.getTotalRowCount; }
110 set { this.getTotalRowCount = value; }
113 public string SortExpression {
114 get { return this.sortExpression; }
116 this.sortExpression = value;
120 public int StartRowIndex {
121 get { return this.startingRowIndex; }
123 this.startingRowIndex = value;
127 public int TotalRowCount {
128 get { return this.totalRowCount; }
130 this.totalRowCount = value;