예제 #1
0
        public async Task <IEnumerable <User> > Get(Guid appId)
        {
            var query = AzureTableHelper.GetRowKeyPrefixQuery <UserMetadataEntity>(appId.ToString(), UserRowKeyPrefix);

            // The actual user doesn't contain anything except for the email we can get from the RowKey.
            // However, if we needed something from the UserEntity, we had to get them one by one.
            var entities = await AzureTableHelper.GetSegmentedResult(_table, query);

            return(entities
                   .Select(ToDto)
                   .ToList());
        }
예제 #2
0
        public async Task <IEnumerable <Message> > GetAll(Guid appId, Guid channelId, int lastN)
        {
            var query = AzureTableHelper.GetRowKeyPrefixQuery <MessageEntity>(appId.ToString(), RowKeyPrefix + channelId);

            var entities = await AzureTableHelper.GetSegmentedResult(_table, query);

            IEnumerable <MessageEntity> orderedEntities = entities
                                                          .OrderByDescending(message => message.CreatedAt);

            if (lastN > 0)
            {
                orderedEntities = orderedEntities.Take(lastN);
            }

            return(orderedEntities
                   .Select(ToDto)
                   .ToList());
        }