Пример #1
0
        public List <T> GetFor <T>(string id, int start = 0, int pageSize = 25)
        {
            var operation = new GetRevisionOperation(Session, id, start, pageSize);
            var command   = operation.CreateRequest();

            if (command == null)
            {
                return(operation.GetRevisionsFor <T>());
            }
            SessionInfo?.IncrementRequestCount();
            RequestExecutor.Execute(command, Context, sessionInfo: SessionInfo);
            operation.SetResult(command.Result);
            return(operation.GetRevisionsFor <T>());
        }
Пример #2
0
        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 <List <T> > GetForAsync <T>(string id, int start = 0, int pageSize = 25, CancellationToken token = default)
        {
            using (Session.AsyncTaskHolder())
            {
                var operation = new GetRevisionOperation(Session, id, start, pageSize);
                var command   = operation.CreateRequest();
                if (command == null)
                {
                    return(operation.GetRevisionsFor <T>());
                }
                SessionInfo?.IncrementRequestCount();
                await RequestExecutor.ExecuteAsync(command, Context, sessionInfo : SessionInfo, token : token).ConfigureAwait(false);

                operation.SetResult(command.Result);
                return(operation.GetRevisionsFor <T>());
            }
        }
Пример #4
0
        public T Get <T>(string id, DateTime date)
        {
            var operation = new GetRevisionOperation(Session, id, date);
            var command   = operation.CreateRequest();

            RequestExecutor.Execute(command, Context, sessionInfo: SessionInfo);
            operation.SetResult(command.Result);
            return(operation.GetRevisionsFor <T>().FirstOrDefault());
        }
Пример #5
0
        public async Task <T> GetAsync <T>(string id, DateTime date, CancellationToken token = default)
        {
            var operation = new GetRevisionOperation(Session, id, date);
            var command   = operation.CreateRequest();
            await RequestExecutor.ExecuteAsync(command, Context, sessionInfo : SessionInfo, token : token).ConfigureAwait(false);

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

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