예제 #1
0
        /// <summary>
        /// 通过托管属性查询条件来查询数据库,把满足条件的实体查询出来。
        /// </summary>
        /// <param name="propertyQuery">托管属性查询条件。</param>
        /// <returns></returns>
        protected EntityList QueryList(IPropertyQuery propertyQuery)
        {
            var args = new PropertyQueryArgs
            {
                PropertyQuery = propertyQuery
            };

            return(this.QueryList(args));
        }
예제 #2
0
 private void BuildDefaultQuerying(PropertyQueryArgs args)
 {
     //树型实体不支持修改排序规则!此逻辑不能放到 OnQueryBuilt 虚方法中,以免被重写。
     if (Repo.SupportTree)
     {
         var dbQuery = args.PropertyQuery as PropertyQuery;
         dbQuery.Orders.Clear();
         dbQuery.OrderBy(Entity.TreeIndexProperty, OrderDirection.Ascending);
     }
 }
예제 #3
0
        /// <summary>
        /// 通过托管属性查询条件来查询数据库,把满足条件的实体查询出来。
        /// </summary>
        /// <param name="args">托管属性查询条件。</param>
        /// <returns></returns>
        /// <exception cref="System.ArgumentNullException">args
        /// or
        /// args.PropertyQuery。</exception>
        /// <exception cref="System.NotSupportedException">使用内存过滤器的同时,不支持提供分页参数。</exception>
        protected EntityList QueryList(PropertyQueryArgs args)
        {
            if (args == null)
            {
                throw new ArgumentNullException("args");
            }
            if (args.PropertyQuery == null)
            {
                throw new ArgumentNullException("args.PropertyQuery。");
            }

            this.PrepareArgs(args);

            this.BuildDefaultQuerying(args);

            //this.OnPropertyQuerying(args);

            var dbQuery = args.PropertyQuery as PropertyQuery;

            IQuery query = this.ConvertToQuery(dbQuery);

            var entityArgs = new EntityQueryArgs
            {
                EntityList = args.EntityList,
                Filter     = args.Filter,
                MemoryList = args.MemoryList,
                PagingInfo = args.PropertyQuery.PagingInfo,
                Query      = query
            };

            entityArgs.SetFetchType(args.FetchType);
            if (dbQuery.EagerLoadProperties != null)
            {
                for (int i = 0, c = dbQuery.EagerLoadProperties.Count; i < c; i++)
                {
                    var item = dbQuery.EagerLoadProperties[i];
                    entityArgs.EagerLoad(item.Property as IProperty, item.Owner);
                }
            }

            return(base.QueryList(entityArgs));
        }
예제 #4
0
 private void BuildDefaultQuerying(PropertyQueryArgs args)
 {
     //树型实体不支持修改排序规则!此逻辑不能放到 OnQueryBuilt 虚方法中,以免被重写。
     if (Repo.SupportTree)
     {
         var dbQuery = args.PropertyQuery as PropertyQuery;
         dbQuery.Orders.Clear();
         dbQuery.OrderBy(Entity.TreeIndexProperty, OrderDirection.Ascending);
     }
 }
예제 #5
0
        /// <summary>
        /// 通过托管属性查询条件来查询数据库,把满足条件的实体查询出来。
        /// </summary>
        /// <param name="args">托管属性查询条件。</param>
        /// <returns></returns>
        /// <exception cref="System.ArgumentNullException">args
        /// or
        /// args.PropertyQuery。</exception>
        /// <exception cref="System.NotSupportedException">使用内存过滤器的同时,不支持提供分页参数。</exception>
        protected EntityList QueryList(PropertyQueryArgs args)
        {
            if (args == null) throw new ArgumentNullException("args");
            if (args.PropertyQuery == null) throw new ArgumentNullException("args.PropertyQuery。");

            this.PrepareArgs(args);

            this.BuildDefaultQuerying(args);

            //this.OnPropertyQuerying(args);

            var dbQuery = args.PropertyQuery as PropertyQuery;

            IQuery query = this.ConvertToQuery(dbQuery);

            var entityArgs = new EntityQueryArgs
            {
                EntityList = args.EntityList,
                Filter = args.Filter,
                MemoryList = args.MemoryList,
                PagingInfo = args.PropertyQuery.PagingInfo,
                Query = query
            };
            entityArgs.SetFetchType(args.FetchType);
            if (dbQuery.EagerLoadProperties != null)
            {
                for (int i = 0, c = dbQuery.EagerLoadProperties.Count; i < c; i++)
                {
                    var item = dbQuery.EagerLoadProperties[i];
                    entityArgs.EagerLoad(item.Property as IProperty, item.Owner);
                }
            }

            return base.QueryList(entityArgs);
        }
예제 #6
0
        /// <summary>
        /// 通过托管属性查询条件来查询数据库,把满足条件的实体查询出来。
        /// </summary>
        /// <param name="propertyQuery">托管属性查询条件。</param>
        /// <returns></returns>
        protected EntityList QueryList(IPropertyQuery propertyQuery)
        {
            var args = new PropertyQueryArgs
            {
                PropertyQuery = propertyQuery
            };

            return this.QueryList(args);
        }