/// <summary> /// Configures Rebus to store saga snapshots in SQL Server /// </summary> public static void StoreInSqlServer(this StandardConfigurer <ISagaSnapshotStorage> configurer, string connectionStringOrConnectionStringName, string tableName, bool automaticallyCreateTables = true) { if (configurer == null) { throw new ArgumentNullException(nameof(configurer)); } if (connectionStringOrConnectionStringName == null) { throw new ArgumentNullException(nameof(connectionStringOrConnectionStringName)); } if (tableName == null) { throw new ArgumentNullException(nameof(tableName)); } configurer.Register(c => { var rebusLoggerFactory = c.Get <IRebusLoggerFactory>(); var connectionProvider = new DbConnectionProvider(connectionStringOrConnectionStringName, rebusLoggerFactory); var snapshotStorage = new SqlServerSagaSnapshotStorage(connectionProvider, tableName, rebusLoggerFactory); if (automaticallyCreateTables) { snapshotStorage.EnsureTableIsCreated(); } return(snapshotStorage); }); }
public ISagaSnapshotStorage Create() { var consoleLoggerFactory = new ConsoleLoggerFactory(true); var connectionProvider = new DbConnectionProvider(SqlTestHelper.ConnectionString, consoleLoggerFactory); var snapperino = new SqlServerSagaSnapshotStorage(connectionProvider, TableName, consoleLoggerFactory); snapperino.EnsureTableIsCreated(); return snapperino; }
/// <summary> /// Configures Rebus to store saga snapshots in SQL Server /// </summary> public static void StoreInSqlServer(this StandardConfigurer<ISagaSnapshotStorage> configurer, string connectionStringOrConnectionStringName, string tableName, bool automaticallyCreateTables = true) { configurer.Register(c => { var connectionProvider = new DbConnectionProvider(connectionStringOrConnectionStringName); var snapshotStorage = new SqlServerSagaSnapshotStorage(connectionProvider, tableName); if (automaticallyCreateTables) { snapshotStorage.EnsureTableIsCreated(); } return snapshotStorage; }); }
/// <summary> /// Configures Rebus to store saga snapshots in SQL Server /// </summary> public static void StoreInSqlServer(this StandardConfigurer<ISagaSnapshotStorage> configurer, Func<Task<IDbConnection>> connectionFactory, string tableName, bool automaticallyCreateTables = true) { if (configurer == null) throw new ArgumentNullException(nameof(configurer)); if (connectionFactory == null) throw new ArgumentNullException(nameof(connectionFactory)); if (tableName == null) throw new ArgumentNullException(nameof(tableName)); configurer.Register(c => { var rebusLoggerFactory = c.Get<IRebusLoggerFactory>(); var connectionProvider = new DbConnectionFactoryProvider(connectionFactory, rebusLoggerFactory); var snapshotStorage = new SqlServerSagaSnapshotStorage(connectionProvider, tableName, rebusLoggerFactory); if (automaticallyCreateTables) { snapshotStorage.EnsureTableIsCreated(); } return snapshotStorage; }); }