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

FindAll() protected static method

Returns all instances found for the specified type according to the criteria
protected static FindAll ( Type targetType, DetachedCriteria detachedCriteria ) : Array
targetType System.Type The target type.
detachedCriteria DetachedCriteria The criteria.
return System.Array
		protected internal static Array FindAll(Type targetType, DetachedCriteria detachedCriteria, params Order[] orders)
		{
			EnsureInitialized(targetType);

			ISession session = holder.CreateSession(targetType);
			
			try
			{
				ICriteria criteria = detachedCriteria.GetExecutableCriteria(session);

				AddOrdersToCriteria(criteria, orders);

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

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

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

Same methods

ActiveRecordBase::FindAll ( Type targetType ) : Array
ActiveRecordBase::FindAll ( Type targetType, NHibernate.Criterion.Order orders ) : Array

Usage Example

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