Esempio n. 1
0
        public List <MetadataAsDictionary> GetMetadataFor(string id, int start = 0, int pageSize = 25)
        {
            var operation = new GetRevisionOperation(Session, id, start, pageSize, true);
            var command   = operation.CreateRequest();

            if (command == null)
            {
                return(operation.GetRevisionsMetadataFor());
            }
            SessionInfo?.IncrementRequestCount();
            RequestExecutor.Execute(command, Context, sessionInfo: SessionInfo);
            operation.SetResult(command.Result);
            return(operation.GetRevisionsMetadataFor());
        }
        public void HandleResponse(GetResponse response)
        {
            BlittableJsonReaderObject responseAsBlittableReaderObject = (BlittableJsonReaderObject)response.Result;

            responseAsBlittableReaderObject.TryGet("Results", out BlittableJsonReaderArray blittableJsonReaderArray);

            _getRevisionOperation.SetResult(new BlittableArrayResult {
                Results = blittableJsonReaderArray
            });
            switch (_mode)
            {
            case Mode.Single:
                Result = _getRevisionOperation.GetRevision <T>();
                break;

            case Mode.Multi:
                Result = _getRevisionOperation.GetRevisionsFor <T>();
                break;

            case Mode.Map:
                Result = _getRevisionOperation.GetRevisions <T>();
                break;

            case Mode.ListOfMetadata:
                Result = _getRevisionOperation.GetRevisionsMetadataFor();
                break;

            default:
                throw new ArgumentOutOfRangeException();
            }
        }
Esempio n. 3
0
        public async Task <List <MetadataAsDictionary> > GetMetadataForAsync(string id, int start = 0, int pageSize = 25, CancellationToken token = default)
        {
            using (Session.AsyncTaskHolder())
            {
                var operation = new GetRevisionOperation(Session, id, start, pageSize, true);
                var command   = operation.CreateRequest();
                if (command == null)
                {
                    return(operation.GetRevisionsMetadataFor());
                }
                SessionInfo?.IncrementRequestCount();
                await RequestExecutor.ExecuteAsync(command, Context, SessionInfo, token).ConfigureAwait(false);

                operation.SetResult(command.Result);
                return(operation.GetRevisionsMetadataFor());
            }
        }
        public async Task <List <MetadataAsDictionary> > GetMetadataForAsync(string id, int start = 0, int pageSize = 25)
        {
            var operation = new GetRevisionOperation(Session, id, start, pageSize, true);
            var command   = operation.CreateRequest();
            await RequestExecutor.ExecuteAsync(command, Context, sessionInfo : SessionInfo).ConfigureAwait(false);

            operation.SetResult(command.Result);
            return(operation.GetRevisionsMetadataFor());
        }