Beispiel #1
0
        private async Task <IStreamStore> GetMsSqlStore(bool dropAll)
        {
            var store = new MsSqlStreamStoreV3(new MsSqlStreamStoreV3Settings(Configuration.MsSqlConnectionString));

            if (dropAll)
            {
                await store.DropAll();
            }
            if (dropAll || !(await store.CheckSchema()).IsMatch())
            {
                store.CreateSchemaIfNotExists().Wait();
            }

            return(store);
        }
        public async Task EnsureSchemaInitialized()
        {
            // `receptionDelay` should include transaction timeout + clock drift. Otherwise, it may skip events during reception.
            var receptionDelay = TimeSpan.FromMilliseconds(3000);
            var eventStore     = new MsSqlStreamStoreV3(new MsSqlStreamStoreV3Settings(ConnectionString));
            await eventStore.DropAll();

            await eventStore.CreateSchemaIfNotExists();

            _eventStore = eventStore;
            Outbox      = new SqlStreamStoreOutbox(eventStore, receptionDelay);
            var db = new TestDbContextWithOutbox(ConnectionString, Outbox);

            db.Database.CreateIfNotExists();
        }