Пример #1
0
        private IEnumerable <IContentIdentifier> GetChronologicallyOrderedContentIdentifiers(string prefix, DateTimeOffset?beforeMoment, DateTimeOffset?afterMoment)
        {
            var container = GetContainer();

            var contentNames =
                _committedContentNamesRepository.GetChronologicallyOrderedContentNames(
                    _containerName,
                    prefix,
                    GetMomentMonth(beforeMoment, 1),
                    GetMomentMonth(afterMoment, -1),
                    CancellationToken.None);

            var result =
                _contentIdentifiersProvider.GetContentIdentifiers(contentNames)
                .Where(x => !_contentIdentifierGenerator.IsSystemContent(x));

            if (beforeMoment.HasValue)
            {
                result = result.Where(x => x.ModifiedMoment < beforeMoment.Value);
            }

            if (afterMoment.HasValue)
            {
                result = result.Where(x => x.ModifiedMoment > afterMoment.Value);
            }

            return(result);
        }
Пример #2
0
 public IEnumerable <IMonthHashAndCount> GetMonthHashAndCounts(IEnumerable <IContentIdentifier> contentIdentifiers)
 {
     return
         (contentIdentifiers
          .Where(x => !_contentIdentifierGenerator.IsSystemContent(x))
          .GroupBy(x => _contentMonthProvider.GetContentMonth(x.ModifiedMoment))
          .Select(x =>
                  new {
         Month = x.Key,
         HashAndCount =
             _hashProvider.GetHashAndCount(
                 x.OrderBy(y => y.ModifiedMoment)
                 .ThenBy(y => y.Guid)
                 .Select(y => Encoding.Unicode.GetBytes(y.Hash))
                 ),
         LastModifiedMoment = x.Max(y => y.ModifiedMoment)
     })
          .OrderBy(x => x.Month)
          .Select(x => _monthHashAndCountFactory(x.Month, x.HashAndCount.Hash, x.HashAndCount.Count, x.LastModifiedMoment)));
 }
Пример #3
0
        public IEnumerable <IContentIdentifier> GetChronologicallyOrderedContentIdentifiers(IContainer container, DateTimeOffset?beforeMoment, DateTimeOffset?afterMoment)
        {
            var result =
                GetContentIdentifiers(container, null)
                .Where(x => !x.Uncommitted)
                .Where(x => !_contentIdentifierGenerator.IsSystemContent(x));

            if (beforeMoment.HasValue)
            {
                result = result.Where(x => x.ModifiedMoment < beforeMoment.Value);
            }

            if (afterMoment.HasValue)
            {
                result = result.Where(x => x.ModifiedMoment > afterMoment.Value);
            }

            return
                (result
                 .OrderBy(x => x.ModifiedMoment)
                 .ThenBy(x => x.Guid));
        }