Пример #1
0
        public TResult[] LoadStartingWith <TTransformer, TResult>(string keyPrefix, string matches = null, int start = 0,
                                                                  int pageSize     = 25, string exclude = null, RavenPagingInformation pagingInformation = null, Action <ILoadConfiguration> configure = null,
                                                                  string skipAfter = null) where TTransformer : AbstractTransformerCreationTask, new()
        {
            IncrementRequestCount();
            var transformer = new TTransformer().TransformerName;

            var configuration = new RavenLoadConfiguration();

            configure?.Invoke(configuration);

            var loadStartingWithOperation = new LoadStartingWithOperation(this);

            loadStartingWithOperation.WithStartWith(keyPrefix, matches, start, pageSize, exclude, pagingInformation, configure, skipAfter);
            loadStartingWithOperation.WithTransformer(transformer, configuration.TransformerParameters);


            var command = loadStartingWithOperation.CreateRequest();

            if (command != null)
            {
                RequestExecuter.Execute(command, Context);
            }

            return(loadStartingWithOperation.GetTransformedDocuments <TResult>(command?.Result));
        }
Пример #2
0
        public T[] LoadStartingWith <T>(string idPrefix, string matches = null, int start = 0, int pageSize = 25, string exclude = null,
                                        string startAfter = null)
        {
            var loadStartingWithOperation = new LoadStartingWithOperation(this);

            LoadStartingWithInternal(idPrefix, loadStartingWithOperation, null, matches, start, pageSize, exclude, startAfter);
            return(loadStartingWithOperation.GetDocuments <T>());
        }
Пример #3
0
        public async Task <IEnumerable <T> > LoadStartingWithAsync <T>(string idPrefix, string matches = null, int start = 0,
                                                                       int pageSize      = 25, string exclude = null,
                                                                       string startAfter = null, CancellationToken token = default(CancellationToken))
        {
            var operation = new LoadStartingWithOperation(this);

            await LoadStartingWithInternal(idPrefix, operation, null, matches, start,
                                           pageSize, exclude, startAfter, token).ConfigureAwait(false);

            return(operation.GetDocuments <T>());
        }
Пример #4
0
        public T[] LoadStartingWith <T>(string keyPrefix, string matches = null, int start = 0, int pageSize = 25, string exclude = null,
                                        RavenPagingInformation pagingInformation = null, string skipAfter = null)
        {
            IncrementRequestCount();

            var loadStartingWithOperation = new LoadStartingWithOperation(this);

            loadStartingWithOperation.WithStartWith(keyPrefix, matches, start, pageSize, exclude, pagingInformation, skipAfter: skipAfter);

            var command = loadStartingWithOperation.CreateRequest();

            if (command != null)
            {
                RequestExecuter.Execute(command, Context);
                loadStartingWithOperation.SetResult(command.Result);
            }

            return(loadStartingWithOperation.GetDocuments <T>());
        }
        public async Task <IEnumerable <T> > LoadStartingWithAsync <T>(string keyPrefix, string matches = null, int start = 0,
                                                                       int pageSize     = 25, string exclude = null, RavenPagingInformation pagingInformation = null,
                                                                       string skipAfter = null, CancellationToken token = default(CancellationToken))
        {
            IncrementRequestCount();

            var loadStartingWithOperation = new LoadStartingWithOperation(this);

            loadStartingWithOperation.WithStartWith(keyPrefix, matches, start, pageSize, exclude, pagingInformation, skipAfter: skipAfter);

            var command = loadStartingWithOperation.CreateRequest();

            if (command != null)
            {
                await RequestExecuter.ExecuteAsync(command, Context, token);

                loadStartingWithOperation.SetResult(command.Result);
            }

            return(loadStartingWithOperation.GetDocuments <T>());
        }
Пример #6
0
        private GetDocumentsCommand LoadStartingWithInternal(string idPrefix, LoadStartingWithOperation operation, Stream stream = null, string matches = null,
                                                             int start         = 0, int pageSize = 25, string exclude = null,
                                                             string startAfter = null)
        {
            operation.WithStartWith(idPrefix, matches, start, pageSize, exclude, startAfter);

            var command = operation.CreateRequest();

            if (command != null)
            {
                RequestExecutor.Execute(command, Context, sessionInfo: SessionInfo);

                if (stream != null)
                {
                    Context.Write(stream, command.Result.Results.Parent);
                }
                else
                {
                    operation.SetResult(command.Result);
                }
            }

            return(command);
        }
Пример #7
0
        private async Task <GetDocumentsCommand> LoadStartingWithInternal(string idPrefix, LoadStartingWithOperation operation, Stream stream = null, string matches = null,
                                                                          int start         = 0, int pageSize = 25, string exclude = null,
                                                                          string startAfter = null, CancellationToken token = default(CancellationToken))
        {
            operation.WithStartWith(idPrefix, matches, start, pageSize, exclude, startAfter);

            var command = operation.CreateRequest();

            if (command != null)
            {
                await RequestExecutor.ExecuteAsync(command, Context, token, SessionInfo).ConfigureAwait(false);

                if (stream != null)
                {
                    Context.Write(stream, command.Result.Results.Parent);
                }
                else
                {
                    operation.SetResult(command.Result);
                }
            }

            return(command);
        }