Exemple #1
0
        /// <summary>
        /// Configures Rebus to execute handlers inside a <see cref="TransactionScope"/>
        /// </summary>
        public static void HandleMessagesInsideTransactionScope(this OptionsConfigurer configurer)
        {
            configurer.Decorate <IPipeline>(c =>
            {
                var pipeline     = c.Get <IPipeline>();
                var stepToInject = new TransactionScopeIncomingStep();

                return(new PipelineStepInjector(pipeline)
                       .OnReceive(stepToInject, PipelineRelativePosition.Before, typeof(DispatchIncomingMessageStep)));
            });
        }
        /// <summary>
        /// Configures Rebus to execute handlers inside a <see cref="TransactionScope"/>
        /// </summary>
        public static void HandleMessagesInsideTransactionScope(this OptionsConfigurer configurer)
        {
            configurer.Decorate<IPipeline>(c =>
            {
                var pipeline = c.Get<IPipeline>();
                var stepToInject = new TransactionScopeIncomingStep();

                return new PipelineStepInjector(pipeline)
                    .OnReceive(stepToInject, PipelineRelativePosition.Before, typeof (DispatchIncomingMessageStep));
            });
        }
        /// <summary>
        /// Configures Rebus to execute handlers inside a <see cref="TransactionScope"/>, using the transaction options
        /// given by <paramref name="transactionOptions"/> for the transaction scope
        /// </summary>
        public static void HandleMessagesInsideTransactionScope(this OptionsConfigurer configurer, TransactionOptions transactionOptions)
        {
            if (configurer == null) throw new ArgumentNullException(nameof(configurer));

            configurer.Decorate<IPipeline>(c =>
            {
                var pipeline = c.Get<IPipeline>();
                var stepToInject = new TransactionScopeIncomingStep(transactionOptions);

                return new PipelineStepInjector(pipeline)
                    .OnReceive(stepToInject, PipelineRelativePosition.Before, typeof(DispatchIncomingMessageStep));
            });
        }
        /// <summary>
        /// Configures Rebus to execute handlers inside a <see cref="TransactionScope"/>, using the transaction options
        /// given by <paramref name="transactionOptions"/> for the transaction scope
        /// </summary>
        public static void HandleMessagesInsideTransactionScope(this OptionsConfigurer configurer, TransactionOptions transactionOptions)
        {
            if (configurer == null)
            {
                throw new ArgumentNullException(nameof(configurer));
            }

            configurer.Decorate <IPipeline>(c =>
            {
                var pipeline     = c.Get <IPipeline>();
                var stepToInject = new TransactionScopeIncomingStep(transactionOptions);

                return(new PipelineStepInjector(pipeline)
                       .OnReceive(stepToInject, PipelineRelativePosition.Before, typeof(DispatchIncomingMessageStep)));
            });
        }