当前位置: 首页>>代码示例>>C#>>正文


C# DetachedCriteria.GetExecutableCriteria方法代码示例

本文整理汇总了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);
            }
        }
开发者ID:stasizb,项目名称:ActiveRecord,代码行数:38,代码来源:ActiveRecordBase.cs

示例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();
 }
开发者ID:reharik,项目名称:CannibalCoder,代码行数:9,代码来源:PermissionsService.cs

示例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);
            }
        }
开发者ID:stasizb,项目名称:ActiveRecord,代码行数:42,代码来源:ActiveRecordBase.cs

示例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;
 }
开发者ID:reharik,项目名称:CannibalCoder,代码行数:12,代码来源:PermissionsService.cs

示例5: NHibernateCountQuery

 public NHibernateCountQuery(DetachedCriteria criteria, ISession session)
 {
     executableCriteria = criteria.GetExecutableCriteria(session);
 }
开发者ID:rexwhitten,项目名称:Siege,代码行数:4,代码来源:NHibernateCountQuery.cs

示例6: Add

		public IMultiCriteria Add(DetachedCriteria detachedCriteria)
		{
			criteriaQueries.Add(
				detachedCriteria.GetExecutableCriteria(session)
				);
			return this;
		}
开发者ID:pallmall,项目名称:WCell,代码行数:7,代码来源:MultiCriteriaImpl.cs

示例7: DeleteAll

 private void DeleteAll(DetachedCriteria criteria)
 {
     foreach (object entity in criteria.GetExecutableCriteria(applicationSession).List())
     {
         applicationSession.Delete(entity);
     }
 }
开发者ID:allinonekk,项目名称:OurProject,代码行数:7,代码来源:InterfaceICAGateway.cs

示例8: Criteria

		public IList Criteria(DetachedCriteria criteria)
		{
			return criteria.GetExecutableCriteria(session).List();
		}
开发者ID:JackWangCUMT,项目名称:rhino-tools,代码行数:4,代码来源:Bumble.cs


注:本文中的DetachedCriteria.GetExecutableCriteria方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。