示例#1
0
        static async Task Main(string[] args)
        {
            await using var container = BuildContainer();

            var source = new TaskCompletionSource();

            var stores = container.AllDocumentStores();
            var board  = new StatusBoard(source.Task);

            var tasks = new List <Task>();

            foreach (var store in stores)
            {
                await store.Advanced.Clean.CompletelyRemoveAllAsync();

                var databases = await store.Storage.AllDatabases();

                foreach (var database in databases)
                {
                    for (var i = 0; i < 10; i++)
                    {
                        var publisher = new Publisher(store, database, board);
                        tasks.Add(publisher.Start());
                    }
                }
            }

            await Task.WhenAll(tasks.ToArray());
        }
示例#2
0
        public Publisher(IDocumentStore store, IMartenDatabase database, StatusBoard board)
        {
            _store    = store;
            _database = database;
            _board    = board;

            var storeName = store.GetType() == typeof(DocumentStore) ? "Marten" : store.GetType().NameInCode();

            _name = $"{storeName}:{_database.Identifier}";
        }