示例#1
0
        public Dictionary <string, T> Get <T>(IEnumerable <string> changeVectors)
        {
            var operation = new GetRevisionOperation(Session, changeVectors);
            var command   = operation.CreateRequest();

            if (command == null)
            {
                return(operation.GetRevisions <T>());
            }
            SessionInfo?.IncrementRequestCount();
            RequestExecutor.Execute(command, Context, sessionInfo: SessionInfo);
            operation.SetResult(command.Result);
            return(operation.GetRevisions <T>());
        }
        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();
            }
        }
示例#3
0
        public async Task <Dictionary <string, T> > GetAsync <T>(IEnumerable <string> changeVectors, CancellationToken token = default)
        {
            using (Session.AsyncTaskHolder())
            {
                var operation = new GetRevisionOperation(Session, changeVectors);
                var command   = operation.CreateRequest();
                if (command == null)
                {
                    return(operation.GetRevisions <T>());
                }
                SessionInfo?.IncrementRequestCount();
                await RequestExecutor.ExecuteAsync(command, Context, sessionInfo : SessionInfo, token).ConfigureAwait(false);

                operation.SetResult(command.Result);
                return(operation.GetRevisions <T>());
            }
        }
        public async Task <Dictionary <string, T> > GetAsync <T>(IEnumerable <string> changeVectors)
        {
            var operation = new GetRevisionOperation(Session, changeVectors);
            var command   = operation.CreateRequest();
            await RequestExecutor.ExecuteAsync(command, Context, sessionInfo : SessionInfo).ConfigureAwait(false);

            operation.SetResult(command.Result);
            return(operation.GetRevisions <T>());
        }