+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
//
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
{
}
#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);
+ }
}
}
+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
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;
}
#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);
- }
}
}
public IClientChannel InnerChannel {
get {
if (inner_channel == null)
+ // FIXME: "factory." might be extraneous.
inner_channel = (ClientRuntimeChannel) (object) factory.CreateChannel ();
return inner_channel;
}