Exemple #1
0
 /// <summary>
 /// Registers a data property binding creation callback for the given type of the framework element
 /// and all subtypes of that type unless a more specific data property binding is registered for that subtype.
 /// </summary>
 /// <param name="elementType">The type of the framework element to register the data property binding for.</param>
 /// <param name="bindingCreator">The data property binding creation callback to register for the given type.</param>
 public static void Register(Type elementType, BindingCreator bindingCreator)
 {
     if (bindingCreator == null)
     {
         throw new ArgumentNullException("bindingCreator");
     }
     bindings[elementType] = bindingCreator;
 }
Exemple #2
0
        public static void Main()
        {
            var channelFactory = new ChannelFactory <IWcfService>(BindingCreator.GetBinding());

            var channel = channelFactory.CreateChannel(new EndpointAddress(BindingCreator.GetAddress().AbsoluteUri + "/Test"));

            // ReSharper disable once SuspiciousTypeConversion.Global
            using ((IDisposable)channel)
            {
                while (true)
                {
                    var task1 = Task.Run(async() => await DoStuffAsync(channel));
                    var task2 = Task.Run(async() => await DoStuffAsync(channel));
                    var task3 = Task.Run(async() => await DoStuffAsync(channel));
                    var task4 = Task.Run(async() => await DoStuffAsync(channel));
                    var task5 = Task.Run(async() => await DoStuffAsync(channel));

                    Task.WaitAll(task1, task2, task3, task4, task5);
                }
            }

            // ReSharper disable once FunctionNeverReturns
        }
Exemple #3
0
        public static void Main()
        {
            var selfHost = new ServiceHost(typeof(WcfServiceImpl), BindingCreator.GetAddress());

            try
            {
                selfHost.AddServiceEndpoint(typeof(IWcfService), BindingCreator.GetBinding(), "Test");

                selfHost.Open();

                Console.WriteLine("The service is ready.");
                Console.WriteLine("Press <ENTER> to terminate service.");
                Console.WriteLine();
                Console.ReadLine();

                selfHost.Close();
            }
            catch (CommunicationException ce)
            {
                Console.WriteLine("An exception occurred: {0}", ce.Message);
                selfHost.Abort();
            }
        }
 /// <summary>
 /// Registers a data property binding creation callback for the given type of the framework element
 /// and all subtypes of that type unless a more specific data property binding is registered for that subtype.
 /// </summary>
 /// <param name="elementType">The type of the framework element to register the data property binding for.</param>
 /// <param name="bindingCreator">The data property binding creation callback to register for the given type.</param>
 public static void Register(Type elementType, BindingCreator bindingCreator)
 {
     if (bindingCreator == null) throw new ArgumentNullException("bindingCreator");
     bindings[elementType] = bindingCreator;
 }