/// <summary> /// Constructs the timeout storage which will use the specified connection string to connect to a database, /// storing the timeouts in the table with the specified name and limit /// </summary> public AdoNetTimeoutStorage(AdoNetConnectionFactory factory, string timeoutsTableName, uint batchSize) { this.factory = factory; this.timeoutsTableName = timeoutsTableName; this.dialect = factory.Dialect; this.batchSize = batchSize; }
public AdoNetUnitOfWorkManager(AdoNetConnectionFactory factory, UOWCreatorDelegate unitOfWorkCreator) { Guard.NotNull(() => factory, factory); Guard.NotNull(() => unitOfWorkCreator, unitOfWorkCreator); _factory = factory; _unitOfWorkCreator = unitOfWorkCreator; }
/// <summary> /// Configures Rebus to store timeouts in AdoNet. /// </summary> public static AdoNetTimeoutStorageFluentConfigurer StoreInAdoNet(this RebusTimeoutsConfigurer configurer, string connectionStringName, string timeoutsTableName) { var connString = GetConnectionString(connectionStringName); var factory = new AdoNetConnectionFactory(connString.ConnectionString, connString.ProviderName); var storage = new AdoNetTimeoutStorage(factory, timeoutsTableName); configurer.Use(storage); return(storage); }
/// <summary> /// Configures Rebus to store timeouts in AdoNet. /// </summary> public static AdoNetTimeoutStorageFluentConfigurer StoreInAdoNet(this RebusTimeoutsConfigurer configurer, string connectionStringName, string timeoutsTableName) { var connString = GetConnectionString(connectionStringName); var factory = new AdoNetConnectionFactory(connString.ConnectionString, connString.ProviderName); var storage = new AdoNetTimeoutStorage(factory, timeoutsTableName); configurer.Use(storage); return storage; }
/// <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; }
public AdoNetUnitOfWork(AdoNetConnectionFactory factory, IMessageContext context) { if (factory == null) throw new ArgumentNullException(nameof(factory)); _factory = factory; _autodispose = context == null; __connection = new Lazy<Tuple<IDbConnection, IDbTransaction>>(() => { var connection = factory.OpenConnection(); var transaction = connection.BeginTransaction(IsolationLevel.ReadCommitted); //< We may require 'Serializable' as our default. _log.Debug("Created new connection {0} and transaction {1}", connection.GetHashCode(), transaction.GetHashCode()); return Tuple.Create(connection, transaction); }); _log.Debug("Created new instance for context: {0}", context?.GetHashCode()); }
/// <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 AdoNetUnitOfWork(AdoNetConnectionFactory factory, IMessageContext context) { if (factory == null) { throw new ArgumentNullException(nameof(factory)); } _factory = factory; _autodispose = context == null; __connection = new Lazy <Tuple <IDbConnection, IDbTransaction> >(() => { var connection = factory.OpenConnection(); var transaction = connection.BeginTransaction(IsolationLevel.ReadCommitted); //< We may require 'Serializable' as our default. _log.Debug("Created new connection {0} and transaction {1}", connection.GetHashCode(), transaction.GetHashCode()); return(Tuple.Create(connection, transaction)); }); _log.Debug("Created new instance for context: {0}", context?.GetHashCode()); }
public void OneTimeSetup() { _factory = new AdoNetConnectionFactory(ConnectionString, ProviderName); }
public AdoNetUnitOfWorkManager(AdoNetConnectionFactory factory) { Guard.NotNull(() => factory, factory); _factory = factory; }
public AdoNetSubscriptionStorage(AdoNetConnectionFactory factory, string subscriptionsTableName) { this.factory = factory; this.subscriptionsTableName = subscriptionsTableName; }
public void OneTimeSetup() { _factory = new AdoNetConnectionFactory(ConnectionString, ProviderName); _manager = new AdoNetUnitOfWorkManager(_factory, (fact, cont) => new AdoNetUnitOfWork(fact, cont)); }
/// <summary> /// Constructs the timeout storage which will use the specified connection string to connect to a database, /// storing the timeouts in the table with the specified name /// </summary> public AdoNetTimeoutStorage(AdoNetConnectionFactory factory, string timeoutsTableName) { this.factory = factory; this.timeoutsTableName = timeoutsTableName; }
/// <summary> /// Constructs the timeout storage which will use the specified connection string to connect to a database, /// storing the timeouts in the table with the specified name /// </summary> public AdoNetTimeoutStorage(AdoNetConnectionFactory factory, string timeoutsTableName) : this(factory, timeoutsTableName, 0) { }