示例#1
0
        public ISagaStorage GetSagaStorage()
        {
            var postgreSqlSagaStorage = new PostgreSqlSagaStorage(PostgreSqlTestHelper.ConnectionHelper, "saga_data", "saga_index", new ConsoleLoggerFactory(false));

            postgreSqlSagaStorage.EnsureTablesAreCreated();
            return(postgreSqlSagaStorage);
        }
        /// <summary>
        /// Configures Rebus to use PostgreSQL to store sagas, using the tables specified to store data and indexed properties respectively.
        /// </summary>
        public static void StoreInPostgres(this StandardConfigurer <ISagaStorage> configurer, IPostgresConnectionProvider connectionProvider, string dataTableName, string indexTableName, bool automaticallyCreateTables = true)
        {
            configurer.Register(c =>
            {
                var rebusLoggerFactory = c.Get <IRebusLoggerFactory>();
                var sagaStorage        = new PostgreSqlSagaStorage(connectionProvider, dataTableName, indexTableName, rebusLoggerFactory);

                if (automaticallyCreateTables)
                {
                    sagaStorage.EnsureTablesAreCreated();
                }

                return(sagaStorage);
            });
        }
示例#3
0
        /// <summary>
        /// Configures Rebus to use PostgreSQL to store sagas, using the tables specified to store data and indexed properties respectively.
        /// </summary>
        public static void StoreInPostgres(this StandardConfigurer <ISagaStorage> configurer,
                                           string connectionString, string dataTableName, string indexTableName,
                                           bool automaticallyCreateTables = true, Action <NpgsqlConnection> additionalConnectionSetup = null)
        {
            configurer.Register(c =>
            {
                var rebusLoggerFactory = c.Get <IRebusLoggerFactory>();
                var sagaStorage        = new PostgreSqlSagaStorage(new PostgresConnectionHelper(connectionString, additionalConnectionSetup), dataTableName, indexTableName, rebusLoggerFactory);

                if (automaticallyCreateTables)
                {
                    sagaStorage.EnsureTablesAreCreated();
                }

                return(sagaStorage);
            });
        }