Example #1
0
        public ListResponse<EventCategory> ListEventCategories()
        {
            var response = new ListResponse<EventCategory>();

            try
            {
                var clnEventCategories = this.StatWinnerDatabase.GetCollection<EventCategoryDBEntity>("EventCategories");
                var sortDefinition = new SortDefinitionBuilder<EventCategoryDBEntity>();
                var lst = clnEventCategories.Find(_ => true)
                    .Sort(sortDefinition.Ascending(s => s.Name))
                    .ToListAsync()
                    .Result.Select(EventManagementFactory.ConvertToEventCategory)
                    .ToList();
                response.Result = lst;
            }
            catch (Exception ex)
            {
                response.SetError(ex);
            }

            return response;
        }
Example #2
0
        /// <summary>
        /// Loads the list of notification events
        /// </summary>
        /// <returns></returns>
        public ListResponse<EventEntity> LoadNotificationEvents()
        {
            var response = new ListResponse<EventEntity>();

            try
            {
                var clnEvents = this.StatWinnerDatabase.GetCollection<EventDbEntity>("NotificationEvents");
                var sortDefinition = new SortDefinitionBuilder<EventDbEntity>();
                var events =
                    clnEvents.Find(_ => true).Sort(sortDefinition.Ascending(r => r.EventKey)).ToListAsync().Result.Select(EventManagementFactory.ConvertToEvent).ToList();


                //Set Event Categories
                var clnEventCategories =
                    this.StatWinnerDatabase.GetCollection<EventCategoryDBEntity>("EventCategories");

                var evenTcategoriIds =
                    events.Where(e => !e.EventCategoryId.IsNullOrEmpty()).Select(e => ObjectId.Parse(e.EventCategoryId)).ToList();

                var eventCategoriesFilter = Builders<EventCategoryDBEntity>.Filter.In("_id", evenTcategoriIds);
                var eventCategories =
                    clnEventCategories.Find(eventCategoriesFilter).ToListAsync().Result.ToList();
                events.ForEach(ev => ev.EventCategoryName = (eventCategories.Single(ec => ec.Id.ToString() == ev.EventCategoryId).Name));

                response.Result = events;
            }
            catch (Exception ex)
            {
                response.SetError(ex);
            }

            return response;
        }
Example #3
0
        public IPageList <T> Query <T>(FilterCondition filter) where T : IBaseObject
        {
            this.CheckType <T>();
            IMongoCollection <T>        collection       = this.GetCollection <T>();
            FilterDefinitionBuilder <T> filter2          = Builders <T> .Filter;
            SortDefinitionBuilder <T>   sort             = Builders <T> .Sort;
            FilterDefinition <T>        filterDefinition = filter2.Empty;

            foreach (FilterValue current in filter.Fields)
            {
                switch (current.FilterType)
                {
                case FilterType.LTE:
                    filterDefinition &= filter2.Lte <object>(current.FieldName, current.Value);
                    break;

                case FilterType.GTE:
                    filterDefinition &= filter2.Gte <object>(current.FieldName, current.Value);
                    break;

                case FilterType.LT:
                    filterDefinition &= filter2.Lt <object>(current.FieldName, current.Value);
                    break;

                case FilterType.GT:
                    filterDefinition &= filter2.Gt <object>(current.FieldName, current.Value);
                    break;

                case FilterType.EQ:
                    goto IL_12E;

                case FilterType.Like:
                    filterDefinition &= filter2.Regex(current.FieldName, new Regex(current.Value.ToString(), RegexOptions.IgnoreCase));
                    break;

                default:
                    goto IL_12E;
                }
                continue;
IL_12E:
                filterDefinition &= filter2.Eq <object>(current.FieldName, current.Value);
            }
            Task <long>        task  = collection.CountAsync(filterDefinition, null, default(CancellationToken));
            SortDefinition <T> sort2 = (filter.Direction == OrderDirection.DESC) ? sort.Descending(filter.OrderBy) : sort.Ascending(filter.OrderBy);
            Task <List <T> >   task2 = collection.Find(filterDefinition, null).Sort(sort2).Limit(new int?(filter.PageSize)).Skip(new int?((filter.PageIndex - 1) * filter.PageSize)).ToListAsync(default(CancellationToken));

            return(new PageList <T>(task2.Result, filter.PageIndex, filter.PageSize, (int)task.Result));
        }
        public ListResponse<Country> LoadAllCountries()
        {
            var response = new ListResponse<Country>();

            try
            {
                var mongoCollection = this.StatWinnerDatabase.GetCollection<CountryEntity>("Countries");
                var sortDefinition = new SortDefinitionBuilder<CountryEntity>();
                var lst =
                    mongoCollection.Find(_ => true)
                        .Sort(sortDefinition.Ascending("name"))
                        .ToListAsync()
                        .Result.Select(UserAccountManagementFactory.convertToCountry)
                        .ToList();
                response.Result = lst;
            }
            catch (Exception ex)
            {
                response.SetError(ex);
            }
            return response;
        }
Example #5
0
        /// <summary>
        /// 根据条件,返回文档集合
        /// </summary>
        /// <typeparam name="TKey"></typeparam>
        /// <param name="filter"></param>
        /// <param name="orderByPropertyName"></param>
        /// <param name="isDescending"></param>
        /// <returns></returns>
        public virtual async Task <List <T> > SelectAsync(FilterDefinition <T> filter, string orderByPropertyName, bool isDescending = true)
        {
            var fluent = Collection.Find(filter);

            if (string.IsNullOrWhiteSpace(orderByPropertyName))
            {
                return(await fluent.ToListAsync());
            }

            var sortDefinitionBuilder = new SortDefinitionBuilder <T>();
            var sort = isDescending ? sortDefinitionBuilder.Descending(orderByPropertyName) : sortDefinitionBuilder.Ascending(orderByPropertyName);

            return(await fluent.Sort(sort).ToListAsync());
        }
Example #6
0
        /// <summary>
        /// 根据条件,返回排序链表查询源
        /// </summary>
        /// <param name="filter"></param>
        /// <param name="orderByPropertyName"></param>
        /// <param name="isDescending"></param>
        /// <returns></returns>
        public virtual IFindFluent <T, T> FluentQueryable(FilterDefinition <T> filter, string orderByPropertyName, bool isDescending = true)
        {
            if (filter == null)
            {
                throw new ArgumentNullException(nameof(filter));
            }
            var fluent = Collection.Find(filter);

            if (string.IsNullOrWhiteSpace(orderByPropertyName))
            {
                return(fluent);
            }

            var sortDefinitionBuilder = new SortDefinitionBuilder <T>();
            var sort = isDescending ? sortDefinitionBuilder.Descending(orderByPropertyName) : sortDefinitionBuilder.Ascending(orderByPropertyName);

            return(fluent.Sort(sort));
        }
Example #7
0
        /// <summary>
        /// return a dataset from database
        /// </summary>
        /// <param name="DatabaseName"></param>
        /// <param name="TableName"></param>
        /// <param name="filterDefinition"></param>
        /// <returns></returns>
        public List <Hashtable> GetColumnDataSet(String DatabaseName, String TableName, List <String> IncludeColumnName, List <String> ExcludeColumnName, FilterDefinition <BsonDocument> filterDefinition, String SortName = "", SortMode sortMode = SortMode.Ascending)
        {
            if (conn == null)
            {
                throw new Exception("Connection has not initialize.");
            }

            if (DatabaseName.Length == 0)
            {
                throw new Exception("Database Name is not exist.");
            }

            IMongoDatabase database = conn.GetDatabase(DatabaseName);

            if (database.ListCollectionNames().ToList().Contains(TableName) == false)
            {
                throw new Exception("Collection Name is not exist in MongoDB Database.");
            }

            IMongoCollection <BsonDocument> collection = database.GetCollection <BsonDocument>(TableName);

            var filter = filterDefinition;


            List <Hashtable> hr = new List <Hashtable>();

            var fieldList = new List <ProjectionDefinition <BsonDocument> >();

            for (int i = 0; i < IncludeColumnName.Count; i++)
            {
                fieldList.Add(Builders <BsonDocument> .Projection.Include(IncludeColumnName[i]));
            }
            for (int i = 0; i < ExcludeColumnName.Count; i++)
            {
                fieldList.Add(Builders <BsonDocument> .Projection.Exclude(ExcludeColumnName[i]));
            }

            var projection = Builders <BsonDocument> .Projection.Combine(fieldList);

            IAsyncCursor <BsonDocument> cursor;

            if (SortName == "")
            {
                cursor = collection.Find(filter).Project(projection).ToCursor();
            }
            else
            {
                SortDefinitionBuilder <BsonDocument> builderSort = Builders <BsonDocument> .Sort;
                SortDefinition <BsonDocument>        sort        =
                    sortMode == SortMode.Ascending ? builderSort.Ascending(SortName) : builderSort.Descending(SortName);
                cursor = collection.Find(filter).Project(projection).Sort(sort).ToCursor();
            }

            foreach (var document in cursor.ToEnumerable())
            {
                Hashtable ht = Json2Hashtable(document.ToJson());
                hr.Add(ht);
            }

            return(hr);
        }
Example #8
0
        static void DoTask(BsonDocument pointitem, TaskScheduler scheduler)
        {
            Action <object> act = obj =>
            {
                try
                {
                    var isactive = Convert.ToDouble(pointitem["isactive"]);
                    //非激活点不处理
                    if (isactive == 0)
                    {
                        return;
                    }

                    var tenantid          = pointitem["tenantid"].ToString();
                    var pointid           = pointitem["pointid"].ToString();
                    var interval          = Convert.ToDouble(pointitem["interval"]);
                    var pointtype         = Convert.ToInt32(pointitem["pointtype"]);
                    var iscompress        = Convert.ToInt32(pointitem["compress"]["iscompress"]);
                    var compressmethod    = pointitem["compress"]["compressmethod"].ToString();
                    var compresscycle     = Convert.ToDouble(pointitem["compress"]["compresscycle"]);
                    var accuracy          = Convert.ToDouble(pointitem["compress"]["accuracy"]);
                    var rtcollection      = pointitem["storage"]["rtcollection"].ToString();
                    var historycollection = pointitem["storage"]["historycollection"].ToString();

                    SortDefinitionBuilder <BsonDocument> builderSort = Builders <BsonDocument> .Sort;
                    //排序约束   Ascending 正序    Descending 倒序
                    //SortDefinition<BsonDocument> sort = builderSort.Ascending("timestampclient");
                    //创建约束生成器
                    FilterDefinitionBuilder <BsonDocument> builderFilter   = Builders <BsonDocument> .Filter;
                    FilterDefinition <BsonDocument>        pointDataFilter = builderFilter.Eq("pointid", pointid) & builderFilter.Eq("tenantid", tenantid);

                    var nowTimestamp = GetTimestamp(DateTime.Now);
                    if (0 == pointtype)//心跳包
                    {
                        var firstPointDataBsonOneResult = _context.RTPointDatasBson(rtcollection).Find <BsonDocument>(pointDataFilter).Sort(builderSort.Ascending("timestampserver")).FirstOrDefault();
                        if (firstPointDataBsonOneResult == null)
                        {
                            return;
                        }

                        var firstTimestamp = (long)firstPointDataBsonOneResult["timestampserver"];
                        if (nowTimestamp - firstTimestamp < compresscycle)
                        {
                            return;
                        }

                        var lastPointDataBsonOneResult = _context.RTPointDatasBson(rtcollection).Find <BsonDocument>(pointDataFilter).Sort(builderSort.Descending("timestampserver")).FirstOrDefault();
                        var lastTimestamp = (long)lastPointDataBsonOneResult["timestampserver"];
                        pointDataFilter = builderFilter.Eq("pointid", pointid) & builderFilter.Eq("tenantid", tenantid) & builderFilter.Lt("timestampserver", lastTimestamp) & builderFilter.Gte("timestampserver", firstTimestamp);
                        var pointDataBsonResult = _context.RTPointDatasBson(rtcollection).Find <BsonDocument>(pointDataFilter).Sort(builderSort.Ascending("timestampserver")).Skip(0).Limit(5000).ToList();
                        if (pointDataBsonResult.Count == 0)
                        {
                            return;
                        }

                        pointDataBsonResult.ForEach((x) =>
                        {
                            if (x.Contains("_id"))
                            {
                                x.Remove("_id");
                            }
                        });
                        pointDataFilter = builderFilter.Eq("pointid", pointid) & builderFilter.Eq("tenantid", tenantid) & builderFilter.Lte("timestampserver", Convert.ToInt64(pointDataBsonResult[pointDataBsonResult.Count - 1]["timestampserver"])) & builderFilter.Gte("timestampserver", Convert.ToInt64(pointDataBsonResult[0]["timestampserver"]));
                        _context.HistoryPointDatasBson(historycollection).InsertMany(pointDataBsonResult);
                        var deleteResult = _context.RTPointDatasBson(rtcollection).DeleteMany(pointDataFilter);
                        return;
                    }
                    else
                    {
                        var firstPointDataBsonOneResult = _context.RTPointDatasBson(rtcollection).Find <BsonDocument>(pointDataFilter).Sort(builderSort.Ascending("timestampclient")).FirstOrDefault();
                        if (firstPointDataBsonOneResult == null)
                        {
                            return;
                        }

                        var firstTimestamp = (long)firstPointDataBsonOneResult["timestampclient"];
                        if (nowTimestamp - firstTimestamp < compresscycle)
                        {
                            return;
                        }

                        var lastPointDataBsonOneResult = _context.RTPointDatasBson(rtcollection).Find <BsonDocument>(pointDataFilter).Sort(builderSort.Descending("timestampclient")).FirstOrDefault();
                        var lastTimestamp = (long)lastPointDataBsonOneResult["timestampclient"];
                        //取值时全部取出,作为压缩算法处理队列数据
                        pointDataFilter = builderFilter.Eq("pointid", pointid) & builderFilter.Eq("tenantid", tenantid) & builderFilter.Lte("timestampclient", lastTimestamp) & builderFilter.Gte("timestampclient", firstTimestamp);
                        var pointDataBsonResult = _context.RTPointDatasBson(rtcollection).Find <BsonDocument>(pointDataFilter).Sort(builderSort.Ascending("timestampclient")).Skip(0).Limit(5000).ToList();
                        if (pointDataBsonResult.Count == 0)
                        {
                            return;
                        }

                        pointDataBsonResult.ForEach((x) =>
                        {
                            if (x.Contains("_id"))
                            {
                                x.Remove("_id");
                            }
                        });
                        if (iscompress == 0)//不压缩处理
                        {
                            _context.HistoryPointDatasBson(historycollection).InsertMany(pointDataBsonResult);
                            //删除时不留最新数据,不用考虑断电状况,因为没有压缩
                            pointDataFilter = builderFilter.Eq("pointid", pointid) & builderFilter.Eq("tenantid", tenantid) & builderFilter.Lte("timestampserver", Convert.ToInt64(pointDataBsonResult[pointDataBsonResult.Count - 1]["timestampserver"])) & builderFilter.Gte("timestampserver", Convert.ToInt64(pointDataBsonResult[0]["timestampserver"]));
                            var deleteResult = _context.RTPointDatasBson(rtcollection).DeleteMany(pointDataFilter);
                        }
                        else//压缩处理
                        {
                            if (pointDataBsonResult.Count <= 1)
                            {
                                return;
                            }

                            var originData = new List <Point>();
                            pointDataBsonResult.ForEach(x =>
                            {
                                originData.Add(new Point()
                                {
                                    pointid = x["pointid"].ToString(), tenantid = x["tenantid"].ToString(), interval = Convert.ToInt32(x["interval"]), quality = Convert.ToDouble(x["quality"]), timestampClient = (long)x["timestampclient"], timestampServer = (long)x["timestampserver"], value = Convert.ToDouble(x["value"])
                                });
                            });
                            var dataCompressed = new List <Point>();
                            switch (pointtype)
                            {
                            case 2:    //模拟量
                                dataCompressed = CompressUtility.CompressMonitorSDT(originData, accuracy);
                                #region bsondocument demo
                                //var document = new BsonDocument
                                //{
                                //    { "name", "MongoDB" },
                                //    { "type", "Database" },
                                //    { "count", 1 },
                                //    { "info", new BsonDocument
                                //        {
                                //            { "x", 203 },
                                //            { "y", 102 }
                                //        }
                                //    }
                                //};
                                #endregion
                                break;

                            case 1:    //开关量
                                dataCompressed = CompressUtility.CompressSwitch(originData);
                                break;

                            case 3:    //字符串
                                dataCompressed = CompressUtility.CompressString(originData);
                                break;

                            default:
                                break;
                            }
                            var insertBsonDocuments = dataCompressed.Select(i => new BsonDocument {
                                { "pointid", pointid },
                                { "timestampclient", i.timestampClient },
                                { "interval", interval },
                                { "value", i.value },
                                { "quality", i.quality },
                                { "tenantid", tenantid },
                                { "timestampserver", i.timestampServer }
                            });
                            _context.HistoryPointDatasBson(historycollection).InsertMany(insertBsonDocuments);
                            //删除时留一个最新数据,作为下一压缩算法处理队列的第一个数据(用于处理两个处理队列之间发生断电状况)(这里冗余一个数据)
                            pointDataFilter = builderFilter.Eq("pointid", pointid) & builderFilter.Eq("tenantid", tenantid) & builderFilter.Lt("timestampserver", Convert.ToInt64(pointDataBsonResult[pointDataBsonResult.Count - 1]["timestampserver"])) & builderFilter.Gte("timestampserver", Convert.ToInt64(pointDataBsonResult[0]["timestampserver"]));
                            var deleteResult = _context.RTPointDatasBson(rtcollection).DeleteMany(pointDataFilter);
                        }
                    }
                }
                catch (Exception ex)
                {
                    Console.WriteLine("Process compress method:" + ex.Message);
                }
            };

            var task = Task.Factory.StartNew(act, pointitem, CancellationToken.None, TaskCreationOptions.None, scheduler).ContinueWith((t, obj) =>
            {
                if (t.Status != TaskStatus.RanToCompletion)
                {
                    DoTask(pointitem, scheduler);
                }
                //Console.WriteLine(obj);
            }, pointitem);

            _runningTasks.Add(task);
        }
Example #9
0
        public IList <TEntity> SearchFor(PagingFiltering criteria, int pageNo, int pageSize, out long totalCount)
        {
            try
            {
                var resultItems = new List <TEntity>();
                FilterDefinition <TEntity>      filter                = null;
                SortDefinition <TEntity>        sortDefinition        = null;
                SortDefinitionBuilder <TEntity> sortDefinitionBuilder = Builders <TEntity> .Sort;
                int searchval;
                if (null != criteria.filter)
                {
                    // TODO: Need expand query filter base on datatype.
                    if (criteria.filter.Filters != null)
                    {
                        foreach (var item in criteria.filter.Filters)
                        {
                            switch (item.Operator)
                            {
                            case "startswith":


                                if (int.TryParse(item.Value, out searchval))
                                {
                                    if (filter == null)
                                    {
                                        filter = Builders <TEntity> .Filter.Regex(item.Field, new BsonRegularExpression(new Regex("^" + searchval)));
                                    }
                                    else
                                    {
                                        filter = filter & Builders <TEntity> .Filter.Regex(item.Field, new BsonRegularExpression(new Regex("^" + searchval)));
                                    }
                                }
                                else
                                {
                                    if (filter == null)
                                    {
                                        filter = Builders <TEntity> .Filter.Regex(item.Field, new BsonRegularExpression(new Regex("^" + item.Value)));
                                    }
                                    else
                                    {
                                        filter = filter & Builders <TEntity> .Filter.Regex(item.Field, new BsonRegularExpression(new Regex("^" + item.Value)));
                                    }
                                }
                                break;

                            case "eq":
                                if (item.DataType == "int")
                                {
                                    if (filter == null)
                                    {
                                        filter = Builders <TEntity> .Filter.Eq(item.Field, item.intValue);
                                    }
                                    else
                                    {
                                        filter = filter & Builders <TEntity> .Filter.Eq(item.Field, item.intValue);
                                    }
                                }
                                else
                                {
                                    if (int.TryParse(item.Value, out searchval))
                                    {
                                        if (filter == null)
                                        {
                                            filter = Builders <TEntity> .Filter.Eq(item.Field, searchval);
                                        }
                                        else
                                        {
                                            filter = filter & Builders <TEntity> .Filter.Eq(item.Field, searchval);
                                        }
                                    }
                                    else
                                    {
                                        if (filter == null)
                                        {
                                            filter = Builders <TEntity> .Filter.Eq(item.Field, item.Value);
                                        }
                                        else
                                        {
                                            filter = filter & Builders <TEntity> .Filter.Eq(item.Field, item.Value);
                                        }
                                    }
                                }
                                break;

                            case "neq":
                                if (filter == null)
                                {
                                    filter = Builders <TEntity> .Filter.Ne(item.Field, item.Value);
                                }
                                else
                                {
                                    filter = filter & Builders <TEntity> .Filter.Ne(item.Field, item.Value);
                                }
                                break;

                            case "contains":
                                if (filter == null)
                                {
                                    filter = Builders <TEntity> .Filter.Regex(item.Field, "/" + item.Value + "/i");
                                }
                                else
                                {
                                    filter = (filter | Builders <TEntity> .Filter.Regex(item.Field, "/" + item.Value + "/i"));
                                }

                                int result = 0;
                                //As we are not getting DataType of field in search cases so checking that the given search value is a integer. If yes adding it as a number filter as well.
                                if ((!string.IsNullOrEmpty(item.Value)) && int.TryParse(item.Value, out result))
                                {
                                    filter = (filter | Builders <TEntity> .Filter.Eq(item.Field, result));
                                }

                                break;

                            case "endswith":
                                if (filter == null)
                                {
                                    filter = Builders <TEntity> .Filter.Regex(item.Field, new BsonRegularExpression(new Regex(item.Value + "$")));
                                }
                                else
                                {
                                    filter = filter & Builders <TEntity> .Filter.Regex(item.Field, new BsonRegularExpression(new Regex(item.Value + "$")));
                                }
                                break;

                            case "lt":
                                if (filter == null)
                                {
                                    filter = Builders <TEntity> .Filter.Lt(item.Field, item.Value);
                                }
                                else
                                {
                                    filter = filter & Builders <TEntity> .Filter.Lt(item.Field, item.Value);
                                }
                                break;

                            case "gt":
                                if (filter == null)
                                {
                                    filter = Builders <TEntity> .Filter.Gt(item.Field, item.Value);
                                }
                                else
                                {
                                    filter = filter & Builders <TEntity> .Filter.Gt(item.Field, item.Value);
                                }
                                break;

                            case "lte":
                                if (filter == null)
                                {
                                    filter = Builders <TEntity> .Filter.Lte(item.Field, item.Value);
                                }
                                else
                                {
                                    filter = filter & Builders <TEntity> .Filter.Lte(item.Field, item.Value);
                                }
                                break;

                            case "gte":
                                if (filter == null)
                                {
                                    filter = Builders <TEntity> .Filter.Gte(item.Field, item.Value);
                                }
                                else
                                {
                                    filter = filter & Builders <TEntity> .Filter.Gte(item.Field, item.Value);
                                }
                                break;

                            default:
                                break;
                            }
                        }
                    }
                }

                //Added new sort block
                if (null != criteria.Sort)
                {
                    foreach (var sort in criteria.Sort)
                    {
                        if (!string.IsNullOrEmpty(sort.Field))
                        {
                            switch (sort.Dir)
                            {
                            case "asc":
                                if (sortDefinition == null)
                                {
                                    sortDefinition = sortDefinitionBuilder.Ascending(sort.Field);
                                }
                                else
                                {
                                    sortDefinition = sortDefinition.Ascending(sort.Field);
                                }
                                break;

                            case "desc":
                                if (sortDefinition == null)
                                {
                                    sortDefinition = sortDefinitionBuilder.Descending(sort.Field);
                                }
                                else
                                {
                                    sortDefinition = sortDefinition.Descending(sort.Field);
                                }
                                break;
                            }
                        }
                    }
                }


                FilterDefinition <TEntity> filterCriteria;
                if (filter == null)
                {
                    filterCriteria = Builders <TEntity> .Filter.Empty;
                }
                else
                {
                    filterCriteria = filter;
                }

                IFindFluent <TEntity, TEntity> cursor;

                if (sortDefinition == null)
                {
                    cursor = collection.Find(filterCriteria);
                }
                else
                {
                    cursor = collection.Find(filterCriteria).Sort(sortDefinition);
                }

                totalCount = cursor.Count();
                cursor     = cursor.Skip(pageSize * (pageNo - 1));

                if (pageSize >= 0)
                {
                    cursor = cursor.Limit(pageSize);
                }

                resultItems.AddRange(cursor.ToList());
                return(resultItems);
            }
            catch (Exception ex)
            {
                logManager.LogMessage("Message: " + ex.Message + Environment.NewLine + "StackTrace: " + ex.StackTrace + Environment.NewLine + "InnerException: " + ex.InnerException, "", "", LogLevel.Error);
                totalCount = 0;
                return(new List <TEntity>());
            }
        }