protected IMongoQuery StatIntervalQuery(StatQueryObject queryObject) { IMongoQuery query1 = queryObject.IsStartInclude ? Query <StatEntity> .LTE(e => e.Tick, queryObject.StartInterval) : Query <StatEntity> .LT(e => e.Tick, queryObject.StartInterval); IMongoQuery query2 = queryObject.IsEndInclude ? Query <StatEntity> .GTE(e => e.Tick, queryObject.EndInterval) : Query <StatEntity> .GT(e => e.Tick, queryObject.EndInterval); IMongoQuery query = Query.And(query1, query2); return(query); }
private IEnumerable <T> GetStatEntities <T>(IStatisticsRepository <T> statEntityRepository, Interval interval) where T : StatEntity, IEntity { string startTick = _tableValueConverter.DateTimeToComparerTick(interval.Start); string finishTick = _tableValueConverter.DateTimeToComparerTick(interval.Finish); var queryObject = new StatQueryObject { StartInterval = startTick, EndInterval = finishTick, IsStartInclude = false, IsEndInclude = false }; IEnumerable <T> result = statEntityRepository.GetStatEntities(queryObject); return(result); }
public IEnumerable <T> GetStatEntities(StatQueryObject queryObject) { try { IMongoQuery query = StatIntervalQuery(queryObject); return(Collection.Find(query).AsEnumerable()); } catch (InvalidOperationException exception) { throw new NotFoundException(exception); } catch (Exception e) { throw new ApplicationException("Mongo driver failure.", e); } }
public IEnumerable <T> GetStatEntities(StatQueryObject queryObject) { throw new NotImplementedException(); }