5 // Atsushi Enomoto <atsushi@ximian.com>
7 // Copyright (C) 2005 Novell, Inc. http://www.novell.com
9 // Permission is hereby granted, free of charge, to any person obtaining
10 // a copy of this software and associated documentation files (the
11 // "Software"), to deal in the Software without restriction, including
12 // without limitation the rights to use, copy, modify, merge, publish,
13 // distribute, sublicense, and/or sell copies of the Software, and to
14 // permit persons to whom the Software is furnished to do so, subject to
15 // the following conditions:
17 // The above copyright notice and this permission notice shall be
18 // included in all copies or substantial portions of the Software.
20 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
21 // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
22 // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
23 // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
24 // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
25 // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
26 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
29 using System.Collections.Generic;
30 using System.Collections.ObjectModel;
31 using System.Reflection;
32 using System.ServiceModel;
33 using System.ServiceModel.Channels;
34 using System.ServiceModel.Description;
37 namespace System.ServiceModel.Dispatcher
39 public sealed class ClientOperation
41 internal class ClientOperationCollection :
43 KeyedCollection<string, ClientOperation>
45 SynchronizedKeyedCollection<string, ClientOperation>
48 protected override string GetKeyForItem (ClientOperation o)
55 string name, action, reply_action;
56 MethodInfo sync_method, begin_method, end_method;
57 bool deserialize_reply = true, serialize_request = true;
58 bool is_initiating, is_terminating, is_oneway;
59 IClientMessageFormatter formatter;
60 SynchronizedCollection<IParameterInspector> inspectors
61 = new SynchronizedCollection<IParameterInspector> ();
62 SynchronizedCollection<FaultContractInfo> fault_contract_infos = new SynchronizedCollection<FaultContractInfo> ();
64 public ClientOperation (ClientRuntime parent,
65 string name, string action)
72 public ClientOperation (ClientRuntime parent,
73 string name, string action, string replyAction)
78 this.reply_action = replyAction;
81 public string Action {
82 get { return action; }
85 public string ReplyAction {
86 get { return reply_action; }
89 public MethodInfo BeginMethod {
90 get { return begin_method; }
97 public bool DeserializeReply {
98 get { return deserialize_reply; }
101 deserialize_reply = value;
105 public MethodInfo EndMethod {
106 get { return end_method; }
113 public SynchronizedCollection<FaultContractInfo> FaultContractInfos {
114 get { return fault_contract_infos; }
117 public IClientMessageFormatter Formatter {
118 get { return formatter; }
125 public bool IsInitiating {
126 get { return is_initiating; }
129 is_initiating = value;
133 public bool IsOneWay {
134 get { return is_oneway; }
141 public bool IsTerminating {
142 get { return is_terminating; }
145 is_terminating = value;
153 public SynchronizedCollection<IParameterInspector> ParameterInspectors {
154 get { return inspectors; }
157 public ClientRuntime Parent {
158 get { return parent; }
161 public bool SerializeRequest {
162 get { return serialize_request; }
165 serialize_request = value;
169 public MethodInfo SyncMethod {
170 get { return sync_method; }
177 void ThrowIfOpened ()
179 // FIXME: get correct state
180 var state = CommunicationState.Created;
182 case CommunicationState.Created:
183 case CommunicationState.Opening:
186 throw new InvalidOperationException ("Cannot change this property after the service host is opened");
191 public ICollection<IParameterInspector> ClientParameterInspectors {
192 get { throw new NotImplementedException (); }
196 public MethodInfo TaskMethod {
197 get { throw new NotImplementedException (); }
198 set { throw new NotImplementedException (); }
202 public Type TaskTResult {
203 get { throw new NotImplementedException (); }
204 set { throw new NotImplementedException (); }