Exemple #1
0
        static async Task Main()
        {
            Type   orderServiceType          = typeof(IOrderContract);
            string endpointConfigurationName = orderServiceType.FullName;
            ChannelFactory <IOrderContract> orderServiceFactory = new ChannelFactory <IOrderContract>(endpointConfigurationName);

            Stopwatch stopwatch = new Stopwatch();

            stopwatch.Start();

            for (int index = 1; index <= 1000; index++)
            {
                IOrderContract orderContract = orderServiceFactory.CreateChannel();

                string orderNo = $"编号{index:D4}";
                string result  = await Task.Run(() => orderContract.CreateOrder(orderNo));

                Console.WriteLine(result);
            }

            stopwatch.Stop();

            Console.WriteLine("==============================================");
            Console.WriteLine(stopwatch.Elapsed);
            Console.ReadKey();
        }
Exemple #2
0
        static void Main(string[] args)
        {
            ChannelFactory <IOrderContract> factory =
                new ChannelFactory <IOrderContract>(new BasicHttpBinding());

            IOrderContract proxy = factory.CreateChannel
                                       (new EndpointAddress("http://localhost:9000/PetShop/OrderService"));

            using ((IDisposable)proxy)
            {
                proxy.PlaceOrder("1 parrot");
            }
        }
 public MemberConsumeController(IMemberConsumeContract memberconsumeContract,
                                IOrderContract orderContract)
 {
     _memberconsumeContract = memberconsumeContract;
     _orderContract         = orderContract;
 }
Exemple #4
0
        public void TestResolveOptionalGeneric()
        {
            IOrderContract orderContract = ResolveMediator.ResolveOptional <OrderContract>();

            Assert.IsNull(orderContract);
        }
Exemple #5
0
        public void TestResolveGeneric()
        {
            IOrderContract orderContract = ResolveMediator.Resolve <IOrderContract>();

            Assert.IsNotNull(orderContract);
        }
 public OrderController(IOrderContract orderContract)
 {
     _orderContract = orderContract;
 }