public override IChannelListener <TChannel> BuildChannelListener <TChannel>(BindingContext context)
        {
            if (context == null)
            {
                throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new ArgumentNullException("context"));
            }

            if (!context.CanBuildInnerChannelListener <TChannel>())
            {
                throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgument("TChannel", SR.GetString(SR.ChannelTypeNotSupported, typeof(TChannel)));
            }

            Dictionary <DirectionalAction, TransactionFlowOption> dictionary = GetDictionary(context);

            if (!this.IsFlowEnabled(dictionary))
            {
                return(context.BuildInnerChannelListener <TChannel>());
            }

            if (this.issuedTokens == TransactionFlowOption.NotAllowed)
            {
                throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new InvalidOperationException(SR.GetString(SR.TransactionFlowRequiredIssuedTokens)));
            }

            IChannelListener <TChannel>           innerListener = context.BuildInnerChannelListener <TChannel>();
            TransactionChannelListener <TChannel> listener      = new TransactionChannelListener <TChannel>(this.transactionProtocol, context.Binding, dictionary, innerListener);

            listener.FlowIssuedTokens = this.IssuedTokens;

            return(listener);
        }
Exemplo n.º 2
0
 public TransactionChannelAcceptor(TransactionChannelListener <TChannel> listener, IChannelListener <TChannel> innerListener)
     : base(listener, innerListener)
 {
     this.listener = listener;
 }