Castle.MonoRail.ActiveRecordSupport.Pagination.ARPaginableCriteria.InternalExecute C# (CSharp) Method

InternalExecute() private method

private InternalExecute ( bool skipPagination ) : IEnumerable
skipPagination bool
return IEnumerable
		private IEnumerable InternalExecute(bool skipPagination)
		{
			ISessionFactoryHolder holder = ActiveRecordMediator.GetSessionFactoryHolder();
			ISession session = holder.CreateSession(targetType);

			try
			{
				ICriteria criteria = session.CreateCriteria(targetType);
			
				if (criterions != null)
				{
					foreach (ICriterion queryCriteria in criterions)
					{
						criteria.Add(queryCriteria);
					}
				}
			
				if (orders != null)
				{
					foreach (Order order in orders)
					{
						criteria.AddOrder(order);
					}
				}

				if (!skipPagination)
				{
					criteria.SetFirstResult(pageSize * (currentPage-1));
					criteria.SetMaxResults(pageSize);
				}

				return criteria.List();
			}
			finally
			{
				holder.ReleaseSession(session);
			}
		}
	}