示例#1
0
        public void DoTest()
        {
            Console.WriteLine("DoTest thread: {0}", Thread.CurrentThread.ManagedThreadId);
            client = WcfServiceClient <INameEntityService> .Create("test1");

            client.AsyncCompleted += new EventHandler <GenericAsyncCompletedEventArgs>(client1_AsynchCompleted);

            //client.AsyncBegin(client.Instance.GetAddress, null, 8);

            client.AsyncBegin("GetAddress", null, 8);
            client.AsyncBegin("DoSomethingElse", null, "comm");     //test a void return type
            client.AsyncBegin("DoNothing", null, null);             //test void return type with no params
        }
 public void DoTest()
 {
     using (var client1 = WcfServiceClient <INameEntityService> .Create("test1"))
     {
         try
         {
             int        type       = 0;
             NameEntity nameEntity = new NameEntity();
             bool       ret        = client1.Instance.CreateNameEntityByTypeByParam(type, ref nameEntity);
             Console.WriteLine("{0}", ret);
         }
         catch (FaultException <WcfServiceFault> fault)
         {
             Console.WriteLine(fault.ToString());
         }
         catch (Exception e) //handles exceptions not in wcf communication
         {
             Console.WriteLine(e.ToString());
         }
     }
 }