Пример #1
0
 public override bool CanBuildChannelFactory <TChannel> (BindingContext bc)
 {
     if (this is BindingElement2)
     {
         Assert.AreEqual(2, bc.Clone().RemainingBindingElements.Count, "1- Cloned context element count");
         Assert.AreEqual(3, bc.Binding.CreateBindingElements().Count, "1- Original binding element count");
         Assert.IsTrue(bc.RemainingBindingElements [0] is InterceptorBindingElement3, "1- binding element 1 type");
         Assert.IsTrue(bc.RemainingBindingElements [1] is BindingElement3, "1- binding element 2 type");
     }
     else
     {
         Assert.AreEqual(1, bc.Clone().RemainingBindingElements.Count, "2- Cloned context element count");
         Assert.AreEqual(3, bc.Binding.CreateBindingElements().Count, "2- Original binding element count");
         Assert.IsTrue(bc.RemainingBindingElements [0] is BindingElement3, "2- binding element 1 type");
     }
     return(base.CanBuildChannelFactory <TChannel> (bc));
 }
Пример #2
0
 void Snippet13()
 {
     // <Snippet13>
     CustomBinding binding                    = new CustomBinding();
     BindingParameterCollection bpCol         = new BindingParameterCollection();
     BindingContext             context       = new BindingContext(binding, bpCol);
     BindingContext             clonedContext = context.Clone();
     // </Snippet13>
 }
Пример #3
0
 public override bool CanBuildChannelFactory <TChannel> (BindingContext bc)
 {
     Assert.AreEqual(1, bc.Clone().RemainingBindingElements.Count, "#i1");
     Assert.IsNull(bc.GetInnerProperty <MessageEncodingBindingElement> (), "#i2");
     Assert.IsNull(bc.GetInnerProperty <MessageEncoder> (), "#i3");
     Assert.IsNull(bc.GetInnerProperty <MessageEncoderFactory> (), "#i4");
     Assert.AreEqual(1, bc.RemainingBindingElements.Count, "#i5");
     Assert.IsTrue(bc.RemainingBindingElements [0] is HttpTransportBindingElement, "#i6");
     Assert.AreEqual(3, bc.Binding.CreateBindingElements().Count, "#i7");
     return(base.CanBuildChannelFactory <TChannel> (bc));
 }
        public SsbChannelListener(SsbBindingElement bindingElement, BindingContext context)
            : base(context.Binding)
        {
            this.bindingElement    = bindingElement;
            originalBindingContext = context.Clone();
            //Address stuff
            if (context.ListenUriMode == ListenUriMode.Unique)
            {
                throw new ProtocolException("ListenUriMode.Unique is not supported. You must provide an explicit address");
            }
            Uri baseAddress = context.ListenUriBaseAddress;

            if (baseAddress == null)
            {
                throw new ProtocolException("Address is null. You must provide an exlpicit address");
            }


            listenUri = new SsbUri(BuildUri(baseAddress, context.ListenUriRelativeAddress));

            //copy properties from binding element
            // TODO how do we enforce MaxReceivedMessgeSize
            this.maxMessageSize = (int)bindingElement.MaxReceivedMessageSize;

            this.connstring    = bindingElement.SqlConnectionString;
            this.bufferManager = BufferManager.CreateBufferManager(bindingElement.MaxBufferPoolSize, this.maxMessageSize);
            MessageEncodingBindingElement messageEncoderBindingElement = context.BindingParameters.Remove <MessageEncodingBindingElement>();

            if (messageEncoderBindingElement != null)
            {
                this.messageEncoderFactory = messageEncoderBindingElement.CreateMessageEncoderFactory();
            }
            else
            {
                this.messageEncoderFactory = SsbConstants.DefaultMessageEncoderFactory;
            }
        }