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));
        }
        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>());
        }
Esempio n. 4
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);
        }
Esempio n. 5
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);
        }