예제 #1
0
        protected override System.ServiceModel.Channels.BindingElement CreateBindingElement()
        {
            SwaEncodingBindingElement BindingElement = new SwaEncodingBindingElement();

            ApplyConfiguration(BindingElement);
            return(BindingElement);
        }
예제 #2
0
        public override void ApplyConfiguration(System.ServiceModel.Channels.BindingElement bindingElement)
        {
            // Base configuration
            base.ApplyConfiguration(bindingElement);

            // Now process the own configuration
            SwaEncodingBindingElement Binding = (SwaEncodingBindingElement)bindingElement;

            PropertyInformationCollection PropertyInfos = ElementInformation.Properties;

            if (PropertyInfos["innerMessageEncoding"].ValueOrigin != PropertyValueOrigin.Default)
            {
                switch (this.InnerMessageEncoding)
                {
                case "textMessageEncoding":
                    Binding.InnerBindingElement = new TextMessageEncodingBindingElement();
                    break;

                case "binaryMessageEncoding":
                    Binding.InnerBindingElement = new BinaryMessageEncodingBindingElement();
                    break;

                default:
                    throw new ConfigurationErrorsException("Inner message encoding can be binary or text, only!");
                }
            }
        }