System.ServiceModel.Dispatcher.EndpointDispatcher.PopulateDispatchOperation C# (CSharp) Method

PopulateDispatchOperation() private method

private PopulateDispatchOperation ( DispatchRuntime db, OperationDescription od ) : void
db DispatchRuntime
od System.ServiceModel.Description.OperationDescription
return void
		void PopulateDispatchOperation (DispatchRuntime db, OperationDescription od) {
			string reqA = null, resA = null;
			foreach (MessageDescription m in od.Messages) {
				if (m.IsRequest)
					reqA = m.Action;
				else
					resA = m.Action;
			}
			DispatchOperation o =
				od.IsOneWay ?
				new DispatchOperation (db, od.Name, reqA) :
				new DispatchOperation (db, od.Name, reqA, resA);
			bool no_serialized_reply = od.IsOneWay;
			foreach (MessageDescription md in od.Messages) {
				if (md.IsRequest &&
					md.Body.Parts.Count == 1 &&
					md.Body.Parts [0].Type == typeof (Message))
					o.DeserializeRequest = false;
				if (!md.IsRequest &&
					md.Body.ReturnValue != null) {
					if (md.Body.ReturnValue.Type == typeof (Message))
						o.SerializeReply = false;
					else if (md.Body.ReturnValue.Type == typeof (void))
						no_serialized_reply = true;
				}
			}

			foreach (var fd in od.Faults)
				o.FaultContractInfos.Add (new FaultContractInfo (fd.Action, fd.DetailType));

			// Setup Invoker
			o.Invoker = new DefaultOperationInvoker (od);

			// Setup Formater
			// FIXME: this seems to be null at initializing, and should be set after applying all behaviors.
			// I leave this as is to not regress and it's cosmetic compatibility to fix.
			// FIXME: pass correct isRpc, isEncoded
			o.Formatter = new OperationFormatter (od, false, false);

			if (o.Action == "*" && (o.IsOneWay || o.ReplyAction == "*")) {
				//Signature : Message  (Message)
				//	    : void  (Message)
				//FIXME: void (IChannel)
				if (!o.DeserializeRequest && (!o.SerializeReply || no_serialized_reply)) // what is this double-ish check for?
					db.UnhandledDispatchOperation = o;
			}

			db.Operations.Add (o);
		}