本文整理汇总了C#中DetachedCriteria.GetExecutableCriteria方法的典型用法代码示例。如果您正苦于以下问题:C# DetachedCriteria.GetExecutableCriteria方法的具体用法?C# DetachedCriteria.GetExecutableCriteria怎么用?C# DetachedCriteria.GetExecutableCriteria使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DetachedCriteria
的用法示例。
在下文中一共展示了DetachedCriteria.GetExecutableCriteria方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: FindAll
/// <summary>
/// Returns all instances found for the specified type according to the criteria
/// </summary>
/// <param name="targetType">The target type.</param>
/// <param name="detachedCriteria">The criteria.</param>
/// <param name="orders">An <see cref="Array"/> of <see cref="Order"/> objects.</param>
/// <returns>The <see cref="Array"/> of results.</returns>
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);
}
}
示例2: FindResults
private Permission[] FindResults(DetachedCriteria criteria)
{
ICollection<Permission> permissions = criteria.GetExecutableCriteria(session)
.AddOrder(Order.Desc("Level"))
.AddOrder(Order.Asc("Allow"))
.SetCacheable(true)
.List<Permission>();
return permissions.ToArray();
}
示例3: SlicedFindAll
/// <summary>
/// Returns a portion of the query results (sliced)
/// </summary>
/// <param name="targetType">The target type.</param>
/// <param name="firstResult">The number of the first row to retrieve.</param>
/// <param name="maxResults">The maximum number of results retrieved.</param>
/// <param name="orders">An <see cref="Array"/> of <see cref="Order"/> objects.</param>
/// <param name="criteria">The criteria expression</param>
/// <returns>The sliced query results.</returns>
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);
}
}
示例4: FindResult
private Permission FindResult(DetachedCriteria criteria)
{
Permission permission = criteria.GetExecutableCriteria(session)
.SetCacheable(true).
UniqueResult<Permission>();
if (permission == null)
{
permission = new Permission();
session.Save(permission);
}
return permission;
}
示例5: NHibernateCountQuery
public NHibernateCountQuery(DetachedCriteria criteria, ISession session)
{
executableCriteria = criteria.GetExecutableCriteria(session);
}
示例6: Add
public IMultiCriteria Add(DetachedCriteria detachedCriteria)
{
criteriaQueries.Add(
detachedCriteria.GetExecutableCriteria(session)
);
return this;
}
示例7: DeleteAll
private void DeleteAll(DetachedCriteria criteria)
{
foreach (object entity in criteria.GetExecutableCriteria(applicationSession).List())
{
applicationSession.Delete(entity);
}
}
示例8: Criteria
public IList Criteria(DetachedCriteria criteria)
{
return criteria.GetExecutableCriteria(session).List();
}