/// <summary> /// Constructs the persister with the ability to create connections to database using the specified connection string. /// This also means that the persister will manage the connection by itself, closing it when it has stopped using it. /// </summary> public AdoNetSagaPersister(AdoNetUnitOfWorkManager manager, string sagaTableName, string sagaIndexTableName) { this.manager = manager; this.sagaTableName = sagaTableName; this.sagaIndexTableName = sagaIndexTableName; this.idPropertyName = Reflect.Path <ISagaData>(x => x.Id); }
/// <summary> /// Configures Rebus to store sagas in AdoNet. /// </summary> public static AdoNetSagaPersisterFluentConfigurer StoreInAdoNet(this RebusSagasConfigurer configurer, string connectionStringName, string sagaTable, string sagaIndexTable) { var connString = GetConnectionString(connectionStringName); var factory = new AdoNetConnectionFactory(connString.ConnectionString, connString.ProviderName); var manager = new AdoNetUnitOfWorkManager(factory); configurer.Backbone.ConfigureEvents(x => x.AddUnitOfWorkManager(manager)); var persister = new AdoNetSagaPersister(manager, sagaTable, sagaIndexTable); configurer.Use(persister); return persister; }
/// <summary> /// Configures Rebus to store sagas in AdoNet. /// </summary> public static AdoNetSagaPersisterFluentConfigurer StoreInAdoNet(this RebusSagasConfigurer configurer, string connectionStringName, string sagaTable, string sagaIndexTable) { var connString = GetConnectionString(connectionStringName); var factory = new AdoNetConnectionFactory(connString.ConnectionString, connString.ProviderName); var manager = new AdoNetUnitOfWorkManager(factory); configurer.Backbone.ConfigureEvents(x => x.AddUnitOfWorkManager(manager)); var persister = new AdoNetSagaPersister(manager, sagaTable, sagaIndexTable); configurer.Use(persister); return(persister); }
/// <summary> /// Configures Rebus to store sagas in AdoNet. /// </summary> public static AdoNetSagaPersisterFluentConfigurer StoreInAdoNet(this RebusSagasConfigurer configurer, string connectionStringName, string sagaTable, string sagaIndexTable, UOWCreatorDelegate unitOfWorkCreator = null) { if (unitOfWorkCreator == null) { unitOfWorkCreator = (fact, cont) => new AdoNetUnitOfWork(fact, cont); } var connString = GetConnectionString(connectionStringName); var factory = new AdoNetConnectionFactory(connString.ConnectionString, connString.ProviderName); var manager = new AdoNetUnitOfWorkManager(factory, unitOfWorkCreator); configurer.Backbone.ConfigureEvents(x => x.AddUnitOfWorkManager(manager)); var persister = new AdoNetSagaPersister(manager, sagaTable, sagaIndexTable); configurer.Use(persister); return(persister); }
public void OneTimeSetup() { _factory = new AdoNetConnectionFactory(ConnectionString, ProviderName); _manager = new AdoNetUnitOfWorkManager(_factory, (fact, cont) => new AdoNetUnitOfWork(fact, cont)); }