Beispiel #1
0
 /// <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;
        }
Beispiel #3
0
        /// <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;
		}
Beispiel #5
0
        /// <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());
        }
Beispiel #10
0
 public void OneTimeSetup()
 {
     _factory = new AdoNetConnectionFactory(ConnectionString, ProviderName);
 }
		public AdoNetUnitOfWorkManager(AdoNetConnectionFactory factory)
		{
			Guard.NotNull(() => factory, factory);

			_factory = factory;
		}
Beispiel #12
0
 public AdoNetSubscriptionStorage(AdoNetConnectionFactory factory, string subscriptionsTableName)
 {
     this.factory = factory;
     this.subscriptionsTableName = subscriptionsTableName;
 }
		public AdoNetSubscriptionStorage(AdoNetConnectionFactory factory, string subscriptionsTableName)
		{
			this.factory = factory;
			this.subscriptionsTableName = subscriptionsTableName;
		}
Beispiel #14
0
 public void OneTimeSetup()
 {
     _factory = new AdoNetConnectionFactory(ConnectionString, ProviderName);
     _manager = new AdoNetUnitOfWorkManager(_factory, (fact, cont) => new AdoNetUnitOfWork(fact, cont));
 }
Beispiel #15
0
 /// <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;
 }
		public void OneTimeSetup()
		{
			_factory = new AdoNetConnectionFactory(ConnectionString, ProviderName);
		}
Beispiel #17
0
 /// <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)
 {
 }
Beispiel #18
0
        public AdoNetUnitOfWorkManager(AdoNetConnectionFactory factory)
        {
            Guard.NotNull(() => factory, factory);

            _factory = factory;
        }
		/// <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;
		}