public async Task PrepareTables()
    {
        LogManager.Use <DefaultFactory>().Level(LogLevel.Debug);

        installer = new OutboxInstaller("S");
        persister = new OutboxPersister(3, "S", "D");
        using (var conn = CreateConnection())
        {
            await conn.OpenAsync().ConfigureAwait(false);

            using (var trans = conn.BeginTransaction())
            {
                await installer.Uninstall("D", conn, trans).ConfigureAwait(false);

                await installer.Install("D", conn, trans).ConfigureAwait(false);

                trans.Commit();
            }
        }
    }
예제 #2
0
        public async Task Start(RootContext rootContext, SettingsHolder extensibilitySettings)
        {
            if (settings.Uninstall)
            {
                foreach (var link in settings.Links)
                {
                    using (var conn = link.Value.ConnectionFactory())
                    {
                        await conn.OpenAsync().ConfigureAwait(false);

                        using (var trans = conn.BeginTransaction())
                        {
                            await outboxInstaller.Uninstall(link.Key, conn, trans).ConfigureAwait(false);

                            await inboxInstaller.Uninstall(link.Key, conn, trans).ConfigureAwait(false);

                            trans.Commit();
                        }
                    }
                }
            }

            foreach (var link in settings.Links)
            {
                using (var conn = link.Value.ConnectionFactory())
                {
                    await conn.OpenAsync().ConfigureAwait(false);

                    using (var trans = conn.BeginTransaction())
                    {
                        await outboxInstaller.Install(link.Key, conn, trans).ConfigureAwait(false);

                        await inboxInstaller.Install(link.Key, conn, trans).ConfigureAwait(false);

                        trans.Commit();
                    }
                }
            }
        }