/// <summary>
        /// 设定批量模式下的搜索语句,继承的类应重载这个函数来指定自己批量模式的搜索语句,如果不指定则默认使用Ids.Contains(x.Id)来代替搜索语句中的Where条件
        /// </summary>
        /// <returns>搜索语句</returns>
        public virtual IOrderedQueryable <TModel> GetBatchQuery()
        {
            var baseQuery = GetSearchQuery();

            if (ReplaceWhere == null)
            {
                var mod      = new WhereReplaceModifier <TModel>(Ids.GetContainIdExpression <TModel>());
                var newExp   = mod.Modify(baseQuery.Expression);
                var newQuery = baseQuery.Provider.CreateQuery <TModel>(newExp) as IOrderedQueryable <TModel>;
                return(newQuery);
            }
            else
            {
                return(baseQuery);
            }
        }
        /// <summary>
        /// 进行搜索
        /// </summary>
        public virtual void DoSearch()
        {
            var cmd = GetSearchCommand();

            if (cmd == null)
            {
                IOrderedQueryable <TModel> query = null;
                //根据搜索模式调用不同的函数
                switch (SearcherMode)
                {
                case ListVMSearchModeEnum.Search:
                    query = GetSearchQuery();
                    break;

                case ListVMSearchModeEnum.Export:
                    query = GetExportQuery();
                    break;

                case ListVMSearchModeEnum.Batch:
                    query = GetBatchQuery();
                    break;

                case ListVMSearchModeEnum.MasterDetail:
                    query = GetMasterDetailsQuery();
                    break;

                case ListVMSearchModeEnum.CheckExport:
                    query = GetCheckedExportQuery();
                    break;

                case ListVMSearchModeEnum.Selector:
                    query = GetSelectorQuery();
                    break;

                default:
                    query = GetSearchQuery();
                    break;
                }

                //如果设定了替换条件,则使用替换条件替换Query中的Where语句
                if (ReplaceWhere != null)
                {
                    var mod    = new WhereReplaceModifier <TopBasePoco>(ReplaceWhere);
                    var newExp = mod.Modify(query.Expression);
                    query = query.Provider.CreateQuery <TModel>(newExp) as IOrderedQueryable <TModel>;
                }
                if (Searcher.SortInfo != null)
                {
                    var mod    = new OrderReplaceModifier(Searcher.SortInfo);
                    var newExp = mod.Modify(query.Expression);
                    query = query.Provider.CreateQuery <TModel>(newExp) as IOrderedQueryable <TModel>;
                }
                if (typeof(TModel).IsSubclassOf(typeof(PersistPoco)))
                {
                    var mod    = new IsValidModifier();
                    var newExp = mod.Modify(query.Expression);
                    query = query.Provider.CreateQuery <TModel>(newExp) as IOrderedQueryable <TModel>;
                }
                if (PassSearch == false)
                {
                    //如果需要分页,则添加分页语句
                    if (NeedPage && Searcher.Limit != -1)
                    {
                        //获取返回数据的数量
                        var count = query.Count();
                        if (count < 0)
                        {
                            count = 0;
                        }
                        if (Searcher.Limit == 0)
                        {
                            Searcher.Limit = GlobalConstants.DEFAULT_PAGESIZE;
                        }
                        //根据返回数据的数量,以及预先设定的每页行数来设定数据量和总页数
                        Searcher.Count     = count;
                        Searcher.PageCount = (int)Math.Ceiling((1.0 * Searcher.Count / Searcher.Limit));
                        if (Searcher.Page <= 0)
                        {
                            Searcher.Page = 1;
                        }
                        if (Searcher.PageCount > 0 && Searcher.Page > Searcher.PageCount)
                        {
                            Searcher.Page = Searcher.PageCount;
                        }
                        EntityList = query.Skip((Searcher.Page - 1) * Searcher.Limit).Take(Searcher.Limit).AsNoTracking().ToList();
                    }
                    else //如果不需要分页则直接获取数据
                    {
                        EntityList         = query.AsNoTracking().ToList();
                        Searcher.Count     = EntityList.Count;
                        Searcher.Limit     = EntityList.Count;
                        Searcher.PageCount = 1;
                        Searcher.Page      = 1;
                    }
                }
                else
                {
                    EntityList = query.AsNoTracking().ToList();
                }
            }
            else
            {
                ProcessCommand(cmd);
            }
            IsSearched = true;
            //调用AfterDoSearch函数来处理自定义的后续操作
            AfterDoSearcher();
        }