Fixing an issue with output parameters that are of type IntPtr
[castle.git] / ActiveRecord / Castle.ActiveRecord / Framework / Queries / Modifiers / QueryRange.cs
blobb3530d85bd2f02811f8495c8097a1f12ec679dac
1 // Copyright 2004-2008 Castle Project - http://www.castleproject.org/
2 //
3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at
6 //
7 // http://www.apache.org/licenses/LICENSE-2.0
8 //
9 // Unless required by applicable law or agreed to in writing, software
10 // distributed under the License is distributed on an "AS IS" BASIS,
11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 // See the License for the specific language governing permissions and
13 // limitations under the License.
15 namespace Castle.ActiveRecord.Queries.Modifiers
17 using NHibernate;
19 /// <summary>
20 /// Limits a query to the specified results.
21 /// </summary>
22 public class QueryRange : IQueryModifier
24 private readonly int firstResult;
25 private readonly int maxResults;
27 /// <summary>
28 /// Initializes a new instance of the <see cref="QueryRange"/> class.
29 /// </summary>
30 /// <param name="firstResult">The first result.</param>
31 /// <param name="maxResults">The max results.</param>
32 public QueryRange(int firstResult, int maxResults)
34 this.firstResult = firstResult;
35 this.maxResults = maxResults;
38 /// <summary>
39 /// Initializes a new instance of the <see cref="QueryRange"/> class.
40 /// </summary>
41 /// <param name="maxResults">The max results.</param>
42 public QueryRange(int maxResults)
43 : this(0, maxResults)
47 /// <summary>
48 /// Gets the first result.
49 /// </summary>
50 /// <value>The first result.</value>
51 public int FirstResult
53 get { return firstResult; }
56 /// <summary>
57 /// Gets the max results.
58 /// </summary>
59 /// <value>The max results.</value>
60 public int MaxResults
62 get { return maxResults; }
65 /// <summary>
66 /// Applies this modifier to the query.
67 /// </summary>
68 /// <param name="query">The query</param>
69 public void Apply(IQuery query)
71 query.SetFirstResult(FirstResult);
72 query.SetMaxResults(MaxResults);