/// <summary>
        /// Configures Rebus to use SQL Server to store timeouts.
        /// </summary>
        public static void StoreInSqlServer(this StandardConfigurer <ITimeoutManager> configurer,
                                            string connectionString, string tableName, bool automaticallyCreateTables = true, bool enlistInAmbientTransaction = false)
        {
            if (configurer == null)
            {
                throw new ArgumentNullException(nameof(configurer));
            }
            if (connectionString == null)
            {
                throw new ArgumentNullException(nameof(connectionString));
            }
            if (tableName == null)
            {
                throw new ArgumentNullException(nameof(tableName));
            }

            configurer.Register(c =>
            {
                var rebusTime           = c.Get <IRebusTime>();
                var rebusLoggerFactory  = c.Get <IRebusLoggerFactory>();
                var connectionProvider  = new DbConnectionProvider(connectionString, rebusLoggerFactory, enlistInAmbientTransaction);
                var subscriptionStorage = new SqlServerTimeoutManager(connectionProvider, tableName, rebusLoggerFactory, rebusTime);

                if (automaticallyCreateTables)
                {
                    subscriptionStorage.EnsureTableIsCreated();
                }

                return(subscriptionStorage);
            });
        }
Example #2
0
        public ITimeoutManager Create()
        {
            var timeoutManager = new SqlServerTimeoutManager(new DbConnectionProvider(SqlTestHelper.ConnectionString), TableName);

            timeoutManager.EnsureTableIsCreated();

            return(timeoutManager);
        }
        public ITimeoutManager Create()
        {
            var consoleLoggerFactory = new ConsoleLoggerFactory(true);
            var connectionProvider   = new DbConnectionProvider(SqlTestHelper.ConnectionString, consoleLoggerFactory);
            var timeoutManager       = new SqlServerTimeoutManager(connectionProvider, TableName, consoleLoggerFactory);

            timeoutManager.EnsureTableIsCreated();

            return(timeoutManager);
        }