Ejemplo n.º 1
0
        public static async Task Main(string[] args)
        {
            var documentStore = BuildDocumentStore();

            var count = 10;

            for (var i = 0; i < count; i++)
            {
                Console.WriteLine($"Issuing query #{i+1} of {count}...");

                var options = new QueryOperationOptions {
                    AllowStale = true
                };
                var deleteOp = new DeleteByQueryOperation(new IndexQuery {
                    Query = "from 'Foobars'"
                }, options);

                var operation = await documentStore.Operations.SendAsync(deleteOp).ConfigureAwait(false);

                await operation.WaitForCompletionAsync().ConfigureAwait(false);

                Thread.Sleep(TimeSpan.FromSeconds(10));
            }

            Console.WriteLine("Press any key to exit");
            Console.ReadLine();
        }
Ejemplo n.º 2
0
		public void RegisterDeletionQuery(string query)
	    {
			var operation = new DeleteByQueryOperation(query);

			IncrementRequestCount();

			registeredOperations.Enqueue(operation);
	    }
        public Task RemoveTimeoutBy(Guid sagaId, ContextBag context)
        {
            var options = new QueryOperationOptions {
                AllowStale = true
            };
            var deleteOp = new DeleteByQueryOperation <Timeout, TimeoutsIndex>(timeout => timeout.SagaId == sagaId, options);

            return(documentStore.Operations.SendAsync(deleteOp));
        }
Ejemplo n.º 4
0
        public async Task RemoveEntriesOlderThan(DateTime dateTime, CancellationToken cancellationToken = default(CancellationToken))
        {
            var options = new QueryOperationOptions {
                AllowStale = true
            };
            var deleteOp = new DeleteByQueryOperation <OutboxRecord, OutboxRecordsIndex>(record => record.Dispatched && record.DispatchedAt <= dateTime, options);

            var operation = await documentStore.Operations.SendAsync(deleteOp, token : cancellationToken).ConfigureAwait(false);

            // This is going to execute multiple "status check" requests to Raven, but this does
            // not currently support CancellationToken.
            await operation.WaitForCompletionAsync().ConfigureAwait(false);
        }
Ejemplo n.º 5
0
        public static void Clean()
        {
            Console.WriteLine("");
            Console.WriteLine("Connecting to " + Urls[0]);
            Console.WriteLine("");
            Console.WriteLine("Clean Started");

            var store = SetupStore();

            var query = new DeleteByQueryOperation <Entity, EverythingIndex>(x => x.Id != "");

            store.Operations.Send(query);
            Console.WriteLine("Clean Finished");
        }