public void ApplyTransactionSupport(IChain chain, IContainer container)
        {
            var shouldFlushOutgoingMessages = chain.ShouldFlushOutgoingMessages();


            var frame = new DbTransactionFrame <NpgsqlTransaction, NpgsqlConnection>
            {
                ShouldFlushOutgoingMessages = shouldFlushOutgoingMessages
            };

            chain.Middleware.Add(frame);
        }
        public void ApplyTransactionSupport(IChain chain)
        {
            var shouldFlushOutgoingMessages = false;

            if (chain is RouteChain)
            {
                shouldFlushOutgoingMessages = chain.As <RouteChain>().Action.Method.GetParameters()
                                              .Any(x => x.ParameterType == typeof(IMessageContext));
            }


            var frame = new DbTransactionFrame <NpgsqlTransaction, NpgsqlConnection> {
                ShouldFlushOutgoingMessages = shouldFlushOutgoingMessages
            };

            chain.Middleware.Add(frame);
        }