Kaynağa Gözat

2010-01-13 Atsushi Enomoto <[email protected]>

	* ContractDescriptionGenerator.cs : fill Operation.Faults.

	* FaultContractInfo.cs : implement.
	* DispatchOperation.cs, ClientOperation.cs: fill Faults.

	* net_2_1_raw_System.ServiceModel.dll.sources :
	  add FaultContractInfo.cs.


svn path=/trunk/mcs/; revision=149445
Atsushi Eno 16 yıl önce
ebeveyn
işleme
4a82278269

+ 5 - 0
mcs/class/System.ServiceModel/ChangeLog

@@ -1,3 +1,8 @@
+2010-01-13  Astushi Enomoto  <[email protected]>
+
+	* net_2_1_raw_System.ServiceModel.dll.sources :
+	  add FaultContractInfo.cs.
+
 2010-01-13  Astushi Enomoto  <[email protected]>
 
 	* net_2_1_raw_System.ServiceModel.dll.sources :

+ 4 - 0
mcs/class/System.ServiceModel/System.ServiceModel.Description/ChangeLog

@@ -1,3 +1,7 @@
+2010-01-13  Atsushi Enomoto  <[email protected]>
+
+	* ContractDescriptionGenerator.cs : fill Operation.Faults.
+
 2010-01-08  Atsushi Enomoto  <[email protected]>
 
 	* ContractDescriptionGenerator.cs : fix GetCallbackContract() to

+ 2 - 0
mcs/class/System.ServiceModel/System.ServiceModel.Description/ContractDescriptionGenerator.cs

@@ -245,6 +245,8 @@ namespace System.ServiceModel.Description
 				foreach (ServiceKnownTypeAttribute a in serviceMethod.GetCustomAttributes (typeof (ServiceKnownTypeAttribute), false))
 					foreach (Type t in a.GetTypes ())
 						od.KnownTypes.Add (t);
+				foreach (FaultContractAttribute a in serviceMethod.GetCustomAttributes (typeof (FaultContractAttribute), false))
+					od.Faults.Add (new FaultDescription (a.Action) { DetailType = a.DetailType, Name = a.Name, Namespace = a.Namespace });
 				cd.Operations.Add (od);
 			}
 			else if (oca.AsyncPattern && od.BeginMethod != null ||

+ 5 - 0
mcs/class/System.ServiceModel/System.ServiceModel.Dispatcher/ChangeLog

@@ -1,3 +1,8 @@
+2010-01-13  Atsushi Enomoto  <[email protected]>
+
+	* FaultContractInfo.cs : implement.
+	* DispatchOperation.cs, ClientOperation.cs: fill Faults.
+
 2010-01-08  Atsushi Enomoto  <[email protected]>
 
 	* EndpointDispatcher.cs, InputOrReplyRequestProcessor.cs :

+ 12 - 1
mcs/class/System.ServiceModel/System.ServiceModel.Dispatcher/ClientOperation.cs

@@ -60,6 +60,9 @@ namespace System.ServiceModel.Dispatcher
 		IClientMessageFormatter formatter, actual_formatter;
 		SynchronizedCollection<IParameterInspector> inspectors
 			= new SynchronizedCollection<IParameterInspector> ();
+#if !NET_2_1
+		SynchronizedCollection<FaultContractInfo> fault_contract_infos;
+#endif
 
 		public ClientOperation (ClientRuntime parent,
 			string name, string action)
@@ -103,7 +106,15 @@ namespace System.ServiceModel.Dispatcher
 
 #if !NET_2_1
 		public SynchronizedCollection<FaultContractInfo> FaultContractInfos {
-			get { throw new NotImplementedException (); }
+			get {
+				if (fault_contract_infos == null) {
+					var l = new SynchronizedCollection<FaultContractInfo> ();
+					foreach (var f in Description.Faults)
+						l.Add (new FaultContractInfo (f.Action, f.DetailType));
+					fault_contract_infos = l;
+				}
+				return fault_contract_infos;
+			}
 		}
 #endif
 

+ 10 - 3
mcs/class/System.ServiceModel/System.ServiceModel.Dispatcher/DispatchOperation.cs

@@ -59,8 +59,7 @@ namespace System.ServiceModel.Dispatcher
 		IOperationInvoker invoker;
 		SynchronizedCollection<IParameterInspector> inspectors
 			= new SynchronizedCollection<IParameterInspector> ();
-		SynchronizedCollection<FaultContractInfo> fault_contract_infos
-			= new SynchronizedCollection<FaultContractInfo> ();
+		SynchronizedCollection<FaultContractInfo> fault_contract_infos;
 		SynchronizedCollection<ICallContextInitializer> ctx_initializers
 			= new SynchronizedCollection<ICallContextInitializer> ();
 
@@ -107,7 +106,15 @@ namespace System.ServiceModel.Dispatcher
 		}
 
 		public SynchronizedCollection<FaultContractInfo> FaultContractInfos {
-			get { return fault_contract_infos; }
+			get {
+				if (fault_contract_infos == null) {
+					var l = new SynchronizedCollection<FaultContractInfo> ();
+					foreach (var f in Description.Faults)
+						l.Add (new FaultContractInfo (f.Action, f.DetailType));
+					fault_contract_infos = l;
+				}
+				return fault_contract_infos;
+			}
 		}
 
 		public IDispatchMessageFormatter Formatter {

+ 8 - 9
mcs/class/System.ServiceModel/System.ServiceModel.Dispatcher/FaultContractInfo.cs

@@ -31,19 +31,18 @@ namespace System.ServiceModel.Dispatcher
 {
 	public class FaultContractInfo
 	{
-		string action;
-		Type detail;
-
 		public FaultContractInfo (string action, Type detail)
 		{
+			if (action == null)
+				throw new ArgumentNullException ("action");
+			if (detail == null)
+				throw new ArgumentNullException ("detail");
+			Action = action;
+			Detail = detail;
 		}
 
-		public string Action {
-			get { return action; }
-		}
+		public string Action { get; private set; }
 
-		public Type Detail {
-			get { return detail; }
-		}
+		public Type Detail { get; private set; }
 	}
 }

+ 1 - 0
mcs/class/System.ServiceModel/net_2_1_raw_System.ServiceModel.dll.sources

@@ -149,6 +149,7 @@ System.ServiceModel.Description/ServiceEndpoint.cs
 System.ServiceModel.Dispatcher/BaseMessagesFormatter.cs
 System.ServiceModel.Dispatcher/ClientOperation.cs
 System.ServiceModel.Dispatcher/ClientRuntime.cs
+System.ServiceModel.Dispatcher/FaultContractInfo.cs
 System.ServiceModel.Dispatcher/IChannelInitializer.cs
 System.ServiceModel.Dispatcher/IClientMessageFormatter.cs
 System.ServiceModel.Dispatcher/IClientMessageInspector.cs