Castle.ActiveRecord.ActiveRecordBase.SlicedFindAll C# (CSharp) Method

SlicedFindAll() protected static method

Returns a portion of the query results (sliced)
protected static SlicedFindAll ( Type targetType, int firstResult, int maxResults, NHibernate.Criterion.Order orders, DetachedCriteria criteria ) : Array
targetType System.Type The target type.
firstResult int The number of the first row to retrieve.
maxResults int The maximum number of results retrieved.
orders NHibernate.Criterion.Order An of objects.
criteria DetachedCriteria The criteria expression
return System.Array
		protected internal static Array SlicedFindAll(Type targetType, int firstResult, int maxResults,
		                                              Order[] orders, DetachedCriteria criteria)
		{
			EnsureInitialized(targetType);

			ISession session = holder.CreateSession(targetType);

			try
			{
				ICriteria executableCriteria = criteria.GetExecutableCriteria(session);
				AddOrdersToCriteria(executableCriteria, orders);
				executableCriteria.SetFirstResult(firstResult);
				executableCriteria.SetMaxResults(maxResults);

				return SupportingUtils.BuildArray(targetType, executableCriteria.List());
			}
			catch(ValidationException)
			{
				holder.FailSession(session);

				throw;
			}
			catch(Exception ex)
			{
				holder.FailSession(session);

				throw new ActiveRecordException("Could not perform SlicedFindAll for " + targetType.Name, ex);
			}
			finally
			{
				holder.ReleaseSession(session);
			}
		}

Same methods

ActiveRecordBase::SlicedFindAll ( Type targetType, int firstResult, int maxResults ) : Array
ActiveRecordBase::SlicedFindAll ( Type targetType, int firstResult, int maxResults, DetachedCriteria criteria ) : Array
ActiveRecordBase::SlicedFindAll ( Type targetType, int firstResult, int maxResults, NHibernate.Criterion.Order orders ) : Array

Usage Example

示例#1
0
 public static T[] FindAll(ICriterion[] criterias, Order[] orders, int firstResult, int maxresults)
 {
     return((T[])ActiveRecordBase.SlicedFindAll(typeof(T), firstResult, maxresults, orders, criterias));
 }
All Usage Examples Of Castle.ActiveRecord.ActiveRecordBase::SlicedFindAll