Beispiel #1
0
 private ICollection <PersistentEvent> GetOldestEvents(string stackId, PagingOptions options)
 {
     return(Find <PersistentEvent>(FindOptionsExtensions.WithPaging(new MultiOptions()
                                                                    .WithStackId(stackId)
                                                                    .WithFields(FieldNames.Id, FieldNames.OrganizationId, FieldNames.ProjectId, FieldNames.StackId)
                                                                    .WithSort(SortBy.Descending(FieldNames.Date_UTC)), options)));
 }
Beispiel #2
0
        public ICollection <PersistentEvent> GetMostRecent(string projectId, DateTime utcStart, DateTime utcEnd, PagingOptions paging, bool includeHidden = false, bool includeFixed = false, bool includeNotFound = true)
        {
            IMongoQuery query = Query.Null;

            if (utcStart != DateTime.MinValue)
            {
                query = query.And(Query.GTE(FieldNames.Date_UTC, utcStart.Ticks));
            }
            if (utcEnd != DateTime.MaxValue)
            {
                query = query.And(Query.LTE(FieldNames.Date_UTC, utcEnd.Ticks));
            }

            if (!includeHidden)
            {
                query = query.And(Query.NE(FieldNames.IsHidden, true));
            }

            if (!includeFixed)
            {
                query = query.And(Query.NE(FieldNames.IsFixed, true));
            }

            if (!includeNotFound)
            {
                query = query.And(Query.NE(FieldNames.Type, "404"));
            }

            return(Find <PersistentEvent>(FindOptionsExtensions.WithPaging(new MultiOptions().WithProjectId(projectId).WithQuery(query), paging).WithSort(SortBy.Descending(FieldNames.Date_UTC))));
        }
Beispiel #3
0
 public virtual ICollection <T> GetByStackId(string stackId, PagingOptions paging = null, bool useCache = false, TimeSpan?expiresIn = null)
 {
     return(Find <T>(FindOptionsExtensions.WithPaging(new MultiOptions()
                                                      .WithStackId(stackId), paging)
                     .WithCacheKey(useCache ? String.Concat("stack:", stackId) : null)
                     .WithExpiresIn(expiresIn)));
 }
Beispiel #4
0
        public ICollection <T> GetByIds(ICollection <string> ids, PagingOptions paging = null, bool useCache = false, TimeSpan?expiresIn = null)
        {
            if (ids == null || ids.Count == 0)
            {
                return(new List <T>());
            }

            string cacheKey = String.Join("", ids).GetHashCode().ToString();

            return(Find <T>(FindOptionsExtensions.WithPaging(new MultiOptions().WithIds(ids), paging).WithCacheKey(useCache ? cacheKey : null).WithExpiresIn(expiresIn)));
        }
Beispiel #5
0
        public virtual ICollection <T> GetByOrganizationIds(ICollection <string> organizationIds, PagingOptions paging = null, bool useCache = false, TimeSpan?expiresIn = null)
        {
            if (organizationIds == null || organizationIds.Count == 0)
            {
                return(new List <T>());
            }

            string cacheKey = String.Concat("org:", String.Join("", organizationIds).GetHashCode().ToString());

            return(Find <T>(FindOptionsExtensions.WithPaging(new MultiOptions()
                                                             .WithOrganizationIds(organizationIds), paging)
                            .WithCacheKey(useCache ? cacheKey : null)
                            .WithExpiresIn(expiresIn)));
        }
Beispiel #6
0
        public ICollection <PersistentEvent> GetByStackIdOccurrenceDate(string stackId, DateTime utcStart, DateTime utcEnd, PagingOptions paging)
        {
            IMongoQuery query = Query.Null;

            if (utcStart != DateTime.MinValue)
            {
                query = query.And(Query.GTE(FieldNames.Date_UTC, utcStart.Ticks));
            }
            if (utcEnd != DateTime.MaxValue)
            {
                query = query.And(Query.LTE(FieldNames.Date_UTC, utcEnd.Ticks));
            }

            return(Find <PersistentEvent>(FindOptionsExtensions.WithPaging(new MultiOptions().WithStackId(stackId).WithQuery(query), paging).WithSort(SortBy.Descending(FieldNames.Date_UTC))));
        }