Example #1
0
        public async Task <IStreamStore> GetStreamStore(string schema)
        {
            var settings = new MsSqlStreamStoreSettings(ConnectionString)
            {
                Schema    = schema,
                GetUtcNow = () => GetUtcNow()
            };
            var store = new MsSqlStreamStore(settings);
            await store.CreateSchema();

            return(store);
        }
Example #2
0
        public void Can_export_database_creation_script()
        {
            string schema = "custom_schema";
            var    store  = new MsSqlStreamStore(new MsSqlStreamStoreSettings("server=.;database=sss")
            {
                Schema = schema,
            });

            var sqlScript = store.GetSchemaCreationScript();

            sqlScript.ShouldBe(new ScriptsV2.Scripts("custom_schema").CreateSchema);
        }
Example #3
0
        public async Task <MsSqlStreamStore> GetStreamStore_v1Schema()
        {
            await CreateDatabase();

            var settings = new MsSqlStreamStoreSettings(ConnectionString)
            {
                Schema    = _schema,
                GetUtcNow = () => GetUtcNow()
            };
            var store = new MsSqlStreamStore(settings);
            await store.CreateSchema_v1_ForTests();

            return(store);
        }
Example #4
0
        public override async Task <IStreamStore> GetStreamStore()
        {
            await CreateDatabase();

            var settings = new MsSqlStreamStoreSettings(ConnectionString)
            {
                Schema    = _schema,
                GetUtcNow = () => GetUtcNow()
            };
            var store = new MsSqlStreamStore(settings);
            await store.DropAll(ignoreErrors : true);

            await store.CreateSchema();

            return(store);
        }
Example #5
0
        public async Task <IStreamStore> GetStreamStore(string schema = "es")
        {
            try
            {
                await CreateDatabase();
            }
            catch (SqlException e) when(e.Number == 1801)
            {
                //for testing, db exists, just ctn
            }

            var settings = new MsSqlStreamStoreSettings(ConnectionString)
            {
                Schema    = schema,
                GetUtcNow = () => GetUtcNow(),
            };
            var store = new SqlStreamStore.MsSqlStreamStore(settings);
            await store.CreateSchema();

            return(store);
        }
        private async Task Init(bool createV1Schema = false)
        {
            await _databaseInstance.CreateDatabase();

            var settings = new MsSqlStreamStoreSettings(ConnectionString)
            {
                Schema    = _schema,
                GetUtcNow = () => GetUtcNow(),
            };

            Store = new MsSqlStreamStore(settings);
            if (_createSchema)
            {
                if (createV1Schema)
                {
                    await Store.CreateSchema_v1_ForTests();
                }
                else
                {
                    await Store.CreateSchema();
                }
            }
        }