Fixing an issue with output parameters that are of type IntPtr
[castle.git] / MonoRail / Castle.MonoRail.ActiveRecordSupport / Pagination / ARPaginableSimpleQuery.cs
bloba8eaf6e1dc833d73674168cd7ccd5501936b3b70
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.MonoRail.ActiveRecordSupport.Pagination
17 using System;
19 using Castle.ActiveRecord.Queries;
21 using NHibernate;
23 /// <summary>
24 /// Performs a simple query and paginate the results.
25 /// </summary>
26 /// <remarks>
27 /// There's no need to supply a <c>returnType</c>, like in
28 /// <see cref="SimpleQuery"/>, as we do not perform the
29 /// conversion of the query results to an array.
30 /// </remarks>
31 public class ARPaginableSimpleQuery : AbstractPaginableQuery
33 private String hql;
34 private object[] parameters;
36 public ARPaginableSimpleQuery(Type targetType, String hql, params object[] parameters) : base(targetType)
38 this.hql = hql;
39 this.parameters = parameters;
42 protected override string BuildHQL()
44 return hql;
47 protected override void SetQueryParameters(IQuery query)
49 int i = 0;
51 foreach (object param in parameters)
53 query.SetParameter(i++, param);