• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# IMethodCallMessage类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中IMethodCallMessage的典型用法代码示例。如果您正苦于以下问题:C# IMethodCallMessage类的具体用法?C# IMethodCallMessage怎么用?C# IMethodCallMessage使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



IMethodCallMessage类属于命名空间,在下文中一共展示了IMethodCallMessage类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: MethodCallContext

 public MethodCallContext(IMethodCallMessage mcm, IMessageSink nextSink)
 {
     mcm.ThrowIfNullArgument(nameof(mcm));
     nextSink.ThrowIfNullArgument(nameof(nextSink));
     _mcm = mcm;
     _nextSink = nextSink;
 }
开发者ID:rexzh,项目名称:RexToy,代码行数:7,代码来源:MethodCallContext.cs


示例2: MethodResponse

 internal MethodResponse(IMethodCallMessage msg, object handlerObject, BinaryMethodReturnMessage smuggledMrm)
 {
     if (msg != null)
     {
         this.MI = msg.MethodBase;
         this._methodCache = InternalRemotingServices.GetReflectionCachedData(this.MI);
         this.methodName = msg.MethodName;
         this.uri = msg.Uri;
         this.typeName = msg.TypeName;
         if (this._methodCache.IsOverloaded())
         {
             this.methodSignature = (Type[]) msg.MethodSignature;
         }
         this.argCount = this._methodCache.Parameters.Length;
     }
     this.retVal = smuggledMrm.ReturnValue;
     this.outArgs = smuggledMrm.Args;
     this.fault = smuggledMrm.Exception;
     this.callContext = smuggledMrm.LogicalCallContext;
     if (smuggledMrm.HasProperties)
     {
         smuggledMrm.PopulateMessageProperties(this.Properties);
     }
     this.fSoap = false;
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:25,代码来源:MethodResponse.cs


示例3: Process

        public void Process(ref IMethodCallMessage msg)
        {
            //Console.WriteLine("Method details: " + msg.MethodBase);

            PrintParameters printParameters = new PrintParameters();
            printParameters.PrintValues(msg);
        }
开发者ID:jredimer2,项目名称:SeleniumLog_NET_Extension,代码行数:7,代码来源:InterceptMethodCalls.cs


示例4: DeserializeMessage

 private IMessage DeserializeMessage(IMethodCallMessage mcm, ITransportHeaders headers, Stream stream)
 {
     IMessage message;
     string str2;
     string str3;
     Header[] h = new Header[] { new Header("__TypeName", mcm.TypeName), new Header("__MethodName", mcm.MethodName), new Header("__MethodSignature", mcm.MethodSignature) };
     string contentType = headers["Content-Type"] as string;
     HttpChannelHelper.ParseContentType(contentType, out str2, out str3);
     if (string.Compare(str2, "text/xml", StringComparison.Ordinal) == 0)
     {
         message = CoreChannel.DeserializeSoapResponseMessage(stream, mcm, h, this._strictBinding);
     }
     else
     {
         int count = 0x400;
         byte[] buffer = new byte[count];
         StringBuilder builder = new StringBuilder();
         for (int i = stream.Read(buffer, 0, count); i > 0; i = stream.Read(buffer, 0, count))
         {
             builder.Append(Encoding.ASCII.GetString(buffer, 0, i));
         }
         message = new ReturnMessage(new RemotingException(builder.ToString()), mcm);
     }
     stream.Close();
     return message;
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:26,代码来源:SoapClientFormatterSink.cs


示例5: GetMethodData

 private MethodData GetMethodData(IMethodCallMessage methodCall)
 {
     MethodData data;
     MethodBase methodBase = methodCall.MethodBase;
     if (!this.methodDataCache.TryGetMethodData(methodBase, out data))
     {
         bool flag;
         System.Type declaringType = methodBase.DeclaringType;
         if (declaringType == typeof(object))
         {
             MethodType getType;
             if (methodCall.MethodBase == typeof(object).GetMethod("GetType"))
             {
                 getType = MethodType.GetType;
             }
             else
             {
                 getType = MethodType.Object;
             }
             flag = true;
             data = new MethodData(methodBase, getType);
         }
         else if (declaringType.IsInstanceOfType(this.serviceChannel))
         {
             flag = true;
             data = new MethodData(methodBase, MethodType.Channel);
         }
         else
         {
             MethodType service;
             ProxyOperationRuntime operation = this.proxyRuntime.GetOperation(methodBase, methodCall.Args, out flag);
             if (operation == null)
             {
                 if (this.serviceChannel.Factory != null)
                 {
                     throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new NotSupportedException(System.ServiceModel.SR.GetString("SFxMethodNotSupported1", new object[] { methodBase.Name })));
                 }
                 throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new NotSupportedException(System.ServiceModel.SR.GetString("SFxMethodNotSupportedOnCallback1", new object[] { methodBase.Name })));
             }
             if (operation.IsSyncCall(methodCall))
             {
                 service = MethodType.Service;
             }
             else if (operation.IsBeginCall(methodCall))
             {
                 service = MethodType.BeginService;
             }
             else
             {
                 service = MethodType.EndService;
             }
             data = new MethodData(methodBase, service, operation);
         }
         if (flag)
         {
             this.methodDataCache.SetMethodData(data);
         }
     }
     return data;
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:60,代码来源:ServiceChannelProxy.cs


示例6: PostMethodExecutionProcess

        public void PostMethodExecutionProcess(IMethodCallMessage callMsg, ref IMethodReturnMessage retMsg)
        {
            _stopwatch.Stop();

            //Console.WriteLine("Return value: {0}", retMsg.ReturnValue);
            //Console.WriteLine("Ticks consumed: {0}", _stopwatch.ElapsedTicks);
        }
开发者ID:jredimer2,项目名称:SeleniumLog_NET_Extension,代码行数:7,代码来源:InterceptMethodCalls.cs


示例7: BuildReturnMessage

		/// <summary>
		/// Builds a method call return message given the returnvalue, out arguments and methodcall.
		/// </summary>
		/// <param name="returnValue">Return value of the methodcall.</param>
		/// <param name="arguments">Input and output argument values.</param>
		/// <param name="callMessage">The original methodcall object.</param>
		/// <remarks>
		/// This method is to be used during recording phase only. A .NET return message object
		/// is constructed based on the given information, where all non-serializable return
		/// values and output arguments are mocked for recording.
		/// </remarks>
		public static IMethodReturnMessage BuildReturnMessage(object returnValue, object[] arguments, IMethodCallMessage callMessage) {
			// Build return message:
			IConstructionCallMessage ccm = callMessage as IConstructionCallMessage;
			if (ccm != null) {
				// If constructor message, build returnmessage from construction:
				return EnterpriseServicesHelper.CreateConstructionReturnMessage(ccm, (MarshalByRefObject)returnValue);
			} else {
				// Wrap return value:
				object wrappedReturnValue;
				wrappedReturnValue = WrapObject(returnValue, ((MethodInfo)callMessage.MethodBase).ReturnType);
				// Copy arguments, wrapping output arguments:
				int outArgsCount = 0;
				object[] wrappedArgs = new object[arguments.Length];
				foreach(ParameterInfo param in callMessage.MethodBase.GetParameters()) {
					if (param.ParameterType.IsByRef) {
						wrappedArgs[param.Position] = WrapObject(arguments[param.Position], param.ParameterType);
						outArgsCount++;
					} else {
						wrappedArgs[param.Position] = arguments[param.Position];
					}
				}
				// Build return message:
				return new ReturnMessage(wrappedReturnValue, wrappedArgs, outArgsCount, callMessage.LogicalCallContext, callMessage);
			}
		}
开发者ID:codetuner,项目名称:Arebis.Common,代码行数:36,代码来源:MockingTools.cs


示例8: CompositionException

		public CompositionException(IMethodCallMessage Message,string message, System.Exception innerException):this(String.Format("Exception:{0}\r\nAssembly:{1}\r\n{2}:{3}\r\nArgs:\r\n",message,Message.TypeName,Message.MethodBase.MemberType,Message.MethodName),innerException)
		{
			for(int i=0; i<Message.ArgCount; i+=2)
			{
				_message = String.Format("{0}\t{1}={2}\r\n",_message,Message.GetArgName(i),Message.GetArg(i).ToString());
			}
			
		}
开发者ID:dialectsoftware,项目名称:DialectSoftware.Composition,代码行数:8,代码来源:CompositionException.cs


示例9: CreateReturnMessage

 private IMethodReturnMessage CreateReturnMessage(object ret, object[] returnArgs, IMethodCallMessage methodCall)
 {
     if (returnArgs != null)
     {
         return this.CreateReturnMessage(ret, returnArgs, returnArgs.Length, SetActivityIdInLogicalCallContext(methodCall.LogicalCallContext), methodCall);
     }
     return new SingleReturnMessage(ret, methodCall);
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:8,代码来源:ServiceChannelProxy.cs


示例10: PreMethodExecutionProcess

        public void PreMethodExecutionProcess(ref IMethodCallMessage msg)
        {
            _stopwatch.Start();
            //Console.WriteLine("Method details: " + msg.MethodBase);

            PrintParameters printParameters = new PrintParameters();
            printParameters.PrintValues(msg);
        }
开发者ID:jredimer2,项目名称:SeleniumLog_NET_Extension,代码行数:8,代码来源:InterceptMethodCalls.cs


示例11: CreateCommands

 public IEnumerable<SqlCommand> CreateCommands(IMethodCallMessage mcm, SqlConnection connection, string schemaName, out SqlParameter returnValue, out SqlParameter[] outParameters, out ISerializationTypeInfo returnTypeInfo, out ICallDeserializationInfo procInfo, out XmlNameTable xmlNameTable,
     IList<IDisposable> disposeList)
 {
     List<SqlCommand> sqlCommands = new List<SqlCommand>();
     SqlCommand sqlCommand = methods[mcm.MethodBase].GetCommand(mcm, connection, out returnValue, out outParameters, out returnTypeInfo, out procInfo, out xmlNameTable, disposeList);
     sqlCommands.Add(sqlCommand);
     return sqlCommands;
 }
开发者ID:avonwyss,项目名称:bsn-modulestore,代码行数:8,代码来源:SqlCallInfo.cs


示例12: CallInterceptionData

 /// <summary>
 /// Creates a new instance of the CallInterceptionData class.
 /// </summary>
 /// <param name="parameters">Parameter values of the intercepted call</param>
 /// <param name="remoteInvoker">Delegate for remote invocation</param>
 /// <param name="remotingMessage">Remoting message</param>
 public CallInterceptionData(object[] parameters, InvokeRemoteMethodDelegate remoteInvoker, IMethodCallMessage remotingMessage)
 {
     Intercepted = false;
     ReturnValue = null;
     Parameters = parameters;
     _remoteInvoker = remoteInvoker;
     _remotingMessage = remotingMessage;
 }
开发者ID:yallie,项目名称:zyan,代码行数:14,代码来源:CallInterceptionData.cs


示例13: TransparentProxyMethodReturn

 /// <summary>
 /// Creates a new <see cref="TransparentProxyMethodReturn"/> object that contains an
 /// exception thrown by the target.
 /// </summary>
 /// <param name="ex">Exception that was thrown.</param>
 /// <param name="callMessage">The original call message that invoked the method.</param>
 /// <param name="invocationContext">Invocation context dictionary passed into the call.</param>
 public TransparentProxyMethodReturn(Exception ex, IMethodCallMessage callMessage, IDictionary invocationContext)
 {
     this.callMessage = callMessage;
     this.invocationContext = invocationContext;
     this.exception = ex;
     this.arguments = new object[0];
     this.outputs = new ParameterCollection(this.arguments, new ParameterInfo[0], pi => false);
 }
开发者ID:shhyder,项目名称:MapApplication,代码行数:15,代码来源:TransparentProxyMethodReturn.cs


示例14: FormatResponse

		// used by the client
		internal IMessage FormatResponse(ISoapMessage soapMsg, IMethodCallMessage mcm) 
		{
			IMessage rtnMsg;
			
			if(soapMsg.MethodName == "Fault") {
				// an exception was thrown by the server
				Exception e = new SerializationException();
				int i = Array.IndexOf(soapMsg.ParamNames, "detail");
				if(_serverFaultExceptionField != null)
					// todo: revue this 'cause it's not safe
					e = (Exception) _serverFaultExceptionField.GetValue(
							soapMsg.ParamValues[i]);
				
				rtnMsg = new ReturnMessage((System.Exception)e, mcm);
			}
			else {
				object rtnObject = null;
				//RemMessageType messageType;
				
				// Get the output of the function if it is not *void*
				if(_methodCallInfo.ReturnType != typeof(void)){
					int index = Array.IndexOf(soapMsg.ParamNames, "return");
					rtnObject = soapMsg.ParamValues[index];
					if(rtnObject is IConvertible) 
						rtnObject = Convert.ChangeType(
								rtnObject, 
								_methodCallInfo.ReturnType);
				}
				
				object[] outParams = new object [_methodCallParameters.Length];
				int n=0;
				
				// check if there are *out* parameters
				foreach(ParameterInfo paramInfo in _methodCallParameters) {
					
					if(paramInfo.ParameterType.IsByRef || paramInfo.IsOut) {
						int index = Array.IndexOf(soapMsg.ParamNames, paramInfo.Name);
						object outParam = soapMsg.ParamValues[index];
						if(outParam is IConvertible)
							outParam = Convert.ChangeType (outParam, paramInfo.ParameterType.GetElementType());
						outParams[n] = outParam;
					}
					else
						outParams [n] = null;
					n++;
				}
				
				Header[] headers = new Header [2 + (soapMsg.Headers != null ? soapMsg.Headers.Length : 0)];
				headers [0] = new Header ("__Return", rtnObject);
				headers [1] = new Header ("__OutArgs", outParams);
				
				if (soapMsg.Headers != null)
					soapMsg.Headers.CopyTo (headers, 2);
					
				rtnMsg = new MethodResponse (headers, mcm);
			}
			return rtnMsg;
		}
开发者ID:jjenki11,项目名称:blaze-chem-rendering,代码行数:59,代码来源:SoapMessageFormatter.cs


示例15: RemotingInvocation

        public RemotingInvocation(RealProxy proxy, IMethodCallMessage message)
        {
            this.message = message;
            this.proxy = proxy;

            arguments = message.Args;
            if (arguments == null)
                arguments = new object[0];
        }
开发者ID:bytedreamer,项目名称:rhino-mocks,代码行数:9,代码来源:RemotingInvocation.cs


示例16: PostProcess

 protected void PostProcess(IMethodCallMessage callMsg, ref IMethodReturnMessage retMsg)
 {
     Trace.WriteLine(String.Format("TracePostProcessor {0} Return:{1}", retMsg.MethodName, retMsg.ReturnValue));
     if (retMsg.OutArgCount > 0) Trace.WriteLine(String.Format("Out Argument Count {0}",retMsg.OutArgCount));
     for (int idx = 0; idx < retMsg.OutArgCount; idx++)
     {
         Trace.WriteLine(String.Format("{0}={1}", retMsg.GetOutArgName(idx), retMsg.GetOutArg(idx)));
     }
 }
开发者ID:WrongDog,项目名称:Aspect,代码行数:9,代码来源:TraceProcessor.cs


示例17: PreProcess

 protected void PreProcess(ref IMethodCallMessage msg)
 {
     Trace.WriteLine(String.Format("TracePreProcessor {0} is called", msg.MethodName));
     if (msg.InArgCount > 0) Trace.WriteLine(String.Format("In Argument Count {0}", msg.InArgCount));
     for (int idx = 0; idx < msg.InArgCount; idx++)
     {
         Trace.WriteLine(String.Format("{0}={1}", msg.GetInArgName(idx), msg.GetInArg(idx)));
     }
 }
开发者ID:WrongDog,项目名称:Aspect,代码行数:9,代码来源:TraceProcessor.cs


示例18: ReturnMessage

	public ReturnMessage(Object ret, Object[] outArgs, int outArgsCount,
						 LogicalCallContext callCtx, IMethodCallMessage mcm)
			{
				this.ret = ret;
				this.outArgs = outArgs;
				this.outArgsCount = outArgsCount;
				this.callCtx = callCtx;
				this.mcm = mcm;
			}
开发者ID:jjenki11,项目名称:blaze-chem-rendering,代码行数:9,代码来源:ReturnMessage.cs


示例19: Invoke

        /// <summary>
        /// Proxy method for substitution of executing methods in adapter interface.
        /// </summary>
        /// <param name="methodCall">The IMessage containing method invoking data.</param>
        /// <returns>The IMessage containing method return data.</returns>
        protected override IMessage Invoke(IMethodCallMessage methodCall)
        {
            ReturnMessage mret = null;

            // Check if this is a method from IAdapter. Any IAdapter methods should be ignored.
            if ((methodCall.MethodBase.DeclaringType.FullName != typeof(IAdapter).FullName)
                && (methodCall.MethodBase.DeclaringType.FullName != typeof(IDisposable).FullName)
                )
            {
                TestSite.Log.Add(LogEntryKind.EnterAdapter,
                    "Interactive adapter: {0}, method: {1}",
                    ProxyType.Name,
                    methodCall.MethodName);
                try
                {
                    // Instantiate a new UI window.
                    using (InteractiveAdapterDialog adapterDlg = new InteractiveAdapterDialog(methodCall, TestSite.Properties))
                    {
                        DialogResult dialogResult = adapterDlg.ShowDialog();

                        if (dialogResult != DialogResult.OK)
                        {
                            string msg = "Failed";
                            TestSite.Assume.Fail(msg);
                        }
                        else
                        {
                            mret = new ReturnMessage(
                                adapterDlg.ReturnValue,
                                adapterDlg.OutArgs.Length > 0 ? adapterDlg.OutArgs : null,
                                adapterDlg.OutArgs.Length,
                                methodCall.LogicalCallContext,
                                methodCall);
                        }
                    }
                }
                catch (Exception ex)
                {
                    TestSite.Log.Add(LogEntryKind.Debug, ex.ToString());
                    throw;
                }
                finally
                {
                    TestSite.Log.Add(LogEntryKind.ExitAdapter,
                        "Interactive adapter: {0}, method: {1}",
                        ProxyType.Name,
                        methodCall.MethodName);
                }
            }
            else
            {
                // TODO: Do we need to take care ReturnMessage (Exception, IMethodCallMessage) ?
                mret = new ReturnMessage(null, null, 0, methodCall.LogicalCallContext, methodCall);
            }

            return mret;
        }
开发者ID:JessieF,项目名称:ProtocolTestFramework,代码行数:62,代码来源:InteractiveAdapterProxy.cs


示例20: SmuggledMethodCallMessage

 private SmuggledMethodCallMessage(IMethodCallMessage mcm)
 {
     this._uri = mcm.Uri;
     this._methodName = mcm.MethodName;
     this._typeName = mcm.TypeName;
     ArrayList argsToSerialize = null;
     IInternalMessage message = mcm as IInternalMessage;
     if ((message == null) || message.HasProperties())
     {
         this._propertyCount = MessageSmuggler.StoreUserPropertiesForMethodMessage(mcm, ref argsToSerialize);
     }
     if (mcm.MethodBase.IsGenericMethod)
     {
         Type[] genericArguments = mcm.MethodBase.GetGenericArguments();
         if ((genericArguments != null) && (genericArguments.Length > 0))
         {
             if (argsToSerialize == null)
             {
                 argsToSerialize = new ArrayList();
             }
             this._instantiation = new MessageSmuggler.SerializedArg(argsToSerialize.Count);
             argsToSerialize.Add(genericArguments);
         }
     }
     if (RemotingServices.IsMethodOverloaded(mcm))
     {
         if (argsToSerialize == null)
         {
             argsToSerialize = new ArrayList();
         }
         this._methodSignature = new MessageSmuggler.SerializedArg(argsToSerialize.Count);
         argsToSerialize.Add(mcm.MethodSignature);
     }
     LogicalCallContext logicalCallContext = mcm.LogicalCallContext;
     if (logicalCallContext == null)
     {
         this._callContext = null;
     }
     else if (logicalCallContext.HasInfo)
     {
         if (argsToSerialize == null)
         {
             argsToSerialize = new ArrayList();
         }
         this._callContext = new MessageSmuggler.SerializedArg(argsToSerialize.Count);
         argsToSerialize.Add(logicalCallContext);
     }
     else
     {
         this._callContext = logicalCallContext.RemotingData.LogicalCallID;
     }
     this._args = MessageSmuggler.FixupArgs(mcm.Args, ref argsToSerialize);
     if (argsToSerialize != null)
     {
         this._serializedArgs = CrossAppDomainSerializer.SerializeMessageParts(argsToSerialize).GetBuffer();
     }
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:57,代码来源:SmuggledMethodCallMessage.cs



注:本文中的IMethodCallMessage类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# IMethodCompiler类代码示例发布时间:2022-05-24
下一篇:
C# IMethodBody类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap