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> ();
63 SynchronizedCollection<FaultContractInfo> fault_contract_infos = new SynchronizedCollection<FaultContractInfo> ();
66 public ClientOperation (ClientRuntime parent,
67 string name, string action)
74 public ClientOperation (ClientRuntime parent,
75 string name, string action, string replyAction)
80 this.reply_action = replyAction;
83 public string Action {
84 get { return action; }
87 public string ReplyAction {
88 get { return reply_action; }
91 public MethodInfo BeginMethod {
92 get { return begin_method; }
99 public bool DeserializeReply {
100 get { return deserialize_reply; }
103 deserialize_reply = value;
107 public MethodInfo EndMethod {
108 get { return end_method; }
116 public SynchronizedCollection<FaultContractInfo> FaultContractInfos {
117 get { return fault_contract_infos; }
121 public IClientMessageFormatter Formatter {
122 get { return formatter; }
129 public bool IsInitiating {
130 get { return is_initiating; }
133 is_initiating = value;
137 public bool IsOneWay {
138 get { return is_oneway; }
145 public bool IsTerminating {
146 get { return is_terminating; }
149 is_terminating = value;
157 public SynchronizedCollection<IParameterInspector> ParameterInspectors {
158 get { return inspectors; }
161 public ClientRuntime Parent {
162 get { return parent; }
165 public bool SerializeRequest {
166 get { return serialize_request; }
169 serialize_request = value;
173 public MethodInfo SyncMethod {
174 get { return sync_method; }
181 void ThrowIfOpened ()
183 // FIXME: get correct state
184 var state = CommunicationState.Created;
186 case CommunicationState.Created:
187 case CommunicationState.Opening:
190 throw new InvalidOperationException ("Cannot change this property after the service host is opened");