protected override void OnApplyConfiguration(Binding binding)
        {
            SsbBinding ssbBinding = (SsbBinding)binding;

            ssbBinding.SenderEndsConversationOnClose = this.SenderEndsConversationOnClose;
            ssbBinding.SqlConnectionString           = this.SqlConnectionString;
        }
        protected override void InitializeFrom(Binding binding)
        {
            base.InitializeFrom(binding);

            SsbBinding ssbBinding = (SsbBinding)binding;

            this.SqlConnectionString           = ssbBinding.SqlConnectionString;
            this.SenderEndsConversationOnClose = ssbBinding.SenderEndsConversationOnClose;
        }
Example #3
0
        static void Main(string[] args)
        {
            SsbBinding serviceBinding = new SsbBinding();
            serviceBinding.SqlConnectionString = Utils.Connectionstring("serviceBinding");
            serviceBinding.UseEncryption = false;
            serviceBinding.UseActionForSsbMessageType = true;
            serviceBinding.Contract = Utils.ChannelContract;

            var host = new ServiceHost(typeof(OrderService.OrderService));
            host.AddServiceEndpoint(typeof(IOrderService), serviceBinding, Utils.ServiceEndpointAddress);
            host.Open();

            Console.WriteLine("Waiting for service to process messages");
            Console.ReadKey();
        }
        public void ImportEndpoint(WsdlImporter importer, WsdlEndpointConversionContext context)
        {
            Console.WriteLine("ImportEndpoint");

            if (context == null)
            {
                throw new ArgumentNullException("context");
            }

            if (context.Endpoint.Binding == null)
            {
                throw new ArgumentNullException("context.Endpoint.Binding");
            }

            BindingElementCollection bindingElements         = context.Endpoint.Binding.CreateBindingElements();
            TransportBindingElement  transportBindingElement = bindingElements.Find <TransportBindingElement>();

            if (transportBindingElement is SsbBindingElement)
            {
                ImportAddress(context);
            }
            if (context.Endpoint.Binding is CustomBinding)
            {
                Binding binding;

                if (transportBindingElement is SsbBindingElement)
                {
                    //if TryCreate is true, the CustomBinding will be replace by a SampleProfileUdpBinding in the
                    //generated config file for better typed generation.
                    if (SsbBinding.TryCreate(bindingElements, out binding))
                    {
                        binding.Name             = context.Endpoint.Binding.Name;
                        binding.Namespace        = context.Endpoint.Binding.Namespace;
                        context.Endpoint.Binding = binding;
                    }
                }
            }
        }
Example #5
0
        public static bool TryCreate(BindingElementCollection elements, out Binding binding)
        {
            binding = null;
            if (elements.Count > 4)
            {
                return(false);
            }

            TextMessageEncodingBindingElement textMessageEncodingBindingElement = null;
            SsbBindingElement ssbBindingElement = null;

            foreach (BindingElement element in elements)
            {
                if (element is TextMessageEncodingBindingElement)
                {
                    textMessageEncodingBindingElement = (TextMessageEncodingBindingElement)element;
                }
                else if (element is SsbBindingElement)
                {
                    ssbBindingElement = (SsbBindingElement)element;
                }
                else
                {
                    return(false);
                }
            }

            if (ssbBindingElement == null || textMessageEncodingBindingElement == null)
            {
                return(false);
            }

            SsbBinding ssbbinding = new SsbBinding();

            ssbbinding.InitializeFrom(ssbBindingElement, textMessageEncodingBindingElement);
            binding = ssbbinding;
            return(true);
        }
Example #6
0
        static void Main(string[] args)
        {
            int i = 0;
            while (true)
            {
                var method = Console.ReadLine();
                if (method == "trigger")
                {
                    var db = new ssb_dbEntities1();
                    var order = new Order
                    {
                        OrderID = Guid.NewGuid(),
                        CustomerName = "trigger" + i
                    };
                    db.Orders.Add(order);
                    db.SaveChanges();
                }
                else if (method == "wcf")
                {
                    SsbBinding clientBinding = new SsbBinding();
                    clientBinding.SqlConnectionString = Utils.Connectionstring("clientBinding");
                    clientBinding.UseEncryption = false;
                    clientBinding.UseActionForSsbMessageType = true;
                    clientBinding.Contract = Utils.ChannelContract;

                    OrderServiceClient client = new OrderServiceClient(clientBinding, new EndpointAddress(Utils.ServiceEndpointAddress));
                    var order = new OrderService.Proxies.Order
                    {
                        OrderId = Guid.NewGuid(),
                        CustomerName = "wcf" + i
                    };
                    client.SubmitOrder(order);
                    client.Close();
                }
                i++;
            }
        }
Example #7
0
        public static bool TryCreate(BindingElementCollection elements, out Binding binding)
        {
            binding = null;
            if (elements.Count > 4)
            {
                return false;
            }

            TextMessageEncodingBindingElement textMessageEncodingBindingElement = null;
            SsbBindingElement ssbBindingElement = null;

            foreach (BindingElement element in elements)
            {
                if (element is TextMessageEncodingBindingElement)
                {
                    textMessageEncodingBindingElement = (TextMessageEncodingBindingElement)element;
                }
                else if (element is SsbBindingElement)
                {
                    ssbBindingElement = (SsbBindingElement)element;
                }
                else
                {
                    return false;
                }
            }

            if (ssbBindingElement == null || textMessageEncodingBindingElement==null)
            {
                return false;
            }

            SsbBinding ssbbinding = new SsbBinding();
            ssbbinding.InitializeFrom(ssbBindingElement, textMessageEncodingBindingElement);
            binding = ssbbinding;
            return true;
        }