2009-02-20 Atsushi Enomoto <atsushi@ximian.com>
authorAtsushi Eno <atsushieno@gmail.com>
Fri, 20 Feb 2009 11:48:21 +0000 (11:48 -0000)
committerAtsushi Eno <atsushieno@gmail.com>
Fri, 20 Feb 2009 11:48:21 +0000 (11:48 -0000)
* ChannelFactory_1.cs : it's not going to create ClientRuntime
  anymore here. Moving to ServiceEndpoint.cs as the first stage.
* ClientBase.cs : some comment.

* ServiceEndpoint.cs : moved CreateRuntime() from ChannelFactory<T>.

svn path=/trunk/mcs/; revision=127531

mcs/class/System.ServiceModel/System.ServiceModel.Description/ChangeLog
mcs/class/System.ServiceModel/System.ServiceModel.Description/ServiceEndpoint.cs
mcs/class/System.ServiceModel/System.ServiceModel/ChangeLog
mcs/class/System.ServiceModel/System.ServiceModel/ChannelFactory_1.cs
mcs/class/System.ServiceModel/System.ServiceModel/ClientBase.cs

index 1266bbe3f8a3e624d53b017d22bdaf878ef7e239..b85236a3f61800600c025ef0ee24d8121fb884e6 100644 (file)
@@ -1,3 +1,7 @@
+2009-02-20  Atsushi Enomoto  <atsushi@ximian.com>
+
+       * ServiceEndpoint.cs : moved CreateRuntime() from ChannelFactory<T>.
+
 2009-02-12  Atsushi Enomoto  <atsushi@ximian.com>
 
        * ContractDescriptionGenerator.cs : do not write body wrapper element
index e1381390250dbab7cf69592aded18164288575ec..465c9eeeba8e8536519e971bd035c4f8e4311541 100644 (file)
@@ -27,8 +27,9 @@
 //
 using System;
 using System.Collections.Generic;
-using System.ServiceModel.Channels;
 using System.ServiceModel;
+using System.ServiceModel.Channels;
+using System.ServiceModel.Dispatcher;
 
 namespace System.ServiceModel.Description
 {
@@ -108,5 +109,57 @@ namespace System.ServiceModel.Description
                        }
 #endif
                }
+
+
+               internal ClientRuntime CreateRuntime ()
+               {
+                       ServiceEndpoint se = this;
+
+                       ClientRuntime proxy = new ClientRuntime (se);
+                       //proxy.ContractClientType = typeof (TChannel);
+
+                       foreach (OperationDescription od in se.Contract.Operations)
+                               if (!proxy.Operations.Contains (od.Name))
+                                       PopulateClientOperation (proxy, od);
+
+#if !NET_2_1
+                       foreach (IEndpointBehavior b in se.Behaviors)
+                               b.ApplyClientBehavior (se, proxy);
+
+                       foreach (IContractBehavior b in se.Contract.Behaviors)
+                               b.ApplyClientBehavior (se.Contract, se, proxy);
+                       foreach (OperationDescription od in se.Contract.Operations)
+                               foreach (IOperationBehavior ob in od.Behaviors)
+                                       ob.ApplyClientBehavior (od, proxy.Operations [od.Name]);
+#endif
+
+                       return proxy;
+               }
+
+               void PopulateClientOperation (ClientRuntime proxy, OperationDescription od)
+               {
+                       string reqA = null, resA = null;
+                       foreach (MessageDescription m in od.Messages) {
+                               if (m.Direction == MessageDirection.Input)
+                                       reqA = m.Action;
+                               else
+                                       resA = m.Action;
+                       }
+                       ClientOperation o =
+                               od.IsOneWay ?
+                               new ClientOperation (proxy, od.Name, reqA) :
+                               new ClientOperation (proxy, od.Name, reqA, resA);
+                       foreach (MessageDescription md in od.Messages) {
+                               if (md.Direction == MessageDirection.Input &&
+                                   md.Body.Parts.Count == 1 &&
+                                   md.Body.Parts [0].Type == typeof (Message))
+                                       o.SerializeRequest = false;
+                               if (md.Direction == MessageDirection.Output &&
+                                   md.Body.ReturnValue != null &&
+                                   md.Body.ReturnValue.Type == typeof (Message))
+                                       o.DeserializeReply = false;
+                       }
+                       proxy.Operations.Add (o);
+               }
        }
 }
index 3a744980379d6b0fe5214f5167ec85a58baf26bf..598c04103903cb63272c692455e22524fa657635 100755 (executable)
@@ -1,3 +1,9 @@
+2009-02-20  Atsushi Enomoto  <atsushi@ximian.com>
+
+       * ChannelFactory_1.cs : it's not going to create ClientRuntime
+         anymore here. Moving to ServiceEndpoint.cs as the first stage.
+       * ClientBase.cs : some comment.
+
 2009-02-13  Atsushi Enomoto  <atsushi@ximian.com>
 
        * ChannelFactory.cs : for default constructor, first try to
index 9f6e17fab9a621ed54ab89179056cdf88f90995a..08c94db57be7a46c014cc8f605c01c5ccfa2acba 100644 (file)
@@ -125,7 +125,7 @@ namespace System.ServiceModel
                        EnsureOpened ();
                        Type type = ClientProxyGenerator.CreateProxyType (Endpoint.Contract);
                        object proxy = Activator.CreateInstance (type,
-                               new object [] {CreateRuntime (Endpoint), this});
+                               new object [] {Endpoint.CreateRuntime (), this});
                        return (TChannel) proxy;
                }
 
@@ -143,54 +143,5 @@ namespace System.ServiceModel
 #endif
                        return ep;
                }
-
-               static ClientRuntime CreateRuntime (ServiceEndpoint se)
-               {
-                       ClientRuntime proxy = new ClientRuntime (se);
-                       proxy.ContractClientType = typeof (TChannel);
-
-                       foreach (OperationDescription od in se.Contract.Operations)
-                               if (!proxy.Operations.Contains (od.Name))
-                                       PopulateClientOperation (proxy, od);
-
-#if !NET_2_1
-                       foreach (IEndpointBehavior b in se.Behaviors)
-                               b.ApplyClientBehavior (se, proxy);
-
-                       foreach (IContractBehavior b in se.Contract.Behaviors)
-                               b.ApplyClientBehavior (se.Contract, se, proxy);
-                       foreach (OperationDescription od in se.Contract.Operations)
-                               foreach (IOperationBehavior ob in od.Behaviors)
-                                       ob.ApplyClientBehavior (od, proxy.Operations [od.Name]);
-#endif
-
-                       return proxy;
-               }
-
-               static void PopulateClientOperation (ClientRuntime proxy, OperationDescription od)
-               {
-                       string reqA = null, resA = null;
-                       foreach (MessageDescription m in od.Messages) {
-                               if (m.Direction == MessageDirection.Input)
-                                       reqA = m.Action;
-                               else
-                                       resA = m.Action;
-                       }
-                       ClientOperation o =
-                               od.IsOneWay ?
-                               new ClientOperation (proxy, od.Name, reqA) :
-                               new ClientOperation (proxy, od.Name, reqA, resA);
-                       foreach (MessageDescription md in od.Messages) {
-                               if (md.Direction == MessageDirection.Input &&
-                                   md.Body.Parts.Count == 1 &&
-                                   md.Body.Parts [0].Type == typeof (Message))
-                                       o.SerializeRequest = false;
-                               if (md.Direction == MessageDirection.Output &&
-                                   md.Body.ReturnValue != null &&
-                                   md.Body.ReturnValue.Type == typeof (Message))
-                                       o.DeserializeReply = false;
-                       }
-                       proxy.Operations.Add (o);
-               }
        }
 }
index b579bb384df0710992e9ad80334bd7f4889f99ab..e66767967eb4d2de16eab5c418e5144d1e2b522f 100644 (file)
@@ -156,6 +156,7 @@ namespace System.ServiceModel
                public IClientChannel InnerChannel {
                        get {
                                if (inner_channel == null)
+                                       // FIXME: "factory." might be extraneous.
                                        inner_channel = (ClientRuntimeChannel) (object) factory.CreateChannel ();
                                return inner_channel;
                        }