示例#1
0
        private object[] WriteMethodReturn(IMethodReturnMessage mrm)
        {
            object returnValue = mrm.ReturnValue;

            object[]  args      = mrm.Args;
            Exception exception = mrm.Exception;

            object[]      properties    = null;
            ReturnMessage returnMessage = mrm as ReturnMessage;

            if (returnMessage == null || returnMessage.HasProperties())
            {
                properties = ObjectWriter.StoreUserPropertiesForMethodMessage(mrm);
            }
            LogicalCallContext logicalCallContext = mrm.LogicalCallContext;
            object             callContext;

            if (logicalCallContext == null)
            {
                callContext = null;
            }
            else if (logicalCallContext.HasInfo)
            {
                callContext = logicalCallContext;
            }
            else
            {
                callContext = logicalCallContext.RemotingData.LogicalCallID;
            }
            return(this.serWriter.WriteReturnArray(returnValue, args, exception, callContext, properties));
        }
示例#2
0
        private object[] WriteMethodCall(IMethodCallMessage mcm)
        {
            string uri             = mcm.Uri;
            string methodName      = mcm.MethodName;
            string typeName        = mcm.TypeName;
            object methodSignature = (object)null;

            object[] properties = (object[])null;
            Type[]   instArgs   = (Type[])null;
            if (mcm.MethodBase.IsGenericMethod)
            {
                instArgs = mcm.MethodBase.GetGenericArguments();
            }
            object[]         args            = mcm.Args;
            IInternalMessage internalMessage = mcm as IInternalMessage;

            if (internalMessage == null || internalMessage.HasProperties())
            {
                properties = ObjectWriter.StoreUserPropertiesForMethodMessage((IMethodMessage)mcm);
            }
            if (mcm.MethodSignature != null && RemotingServices.IsMethodOverloaded((IMethodMessage)mcm))
            {
                methodSignature = mcm.MethodSignature;
            }
            LogicalCallContext logicalCallContext = mcm.LogicalCallContext;
            object             callContext        = logicalCallContext != null ? (!logicalCallContext.HasInfo ? (object)logicalCallContext.RemotingData.LogicalCallID : (object)logicalCallContext) : (object)null;

            return(this.serWriter.WriteCallArray(uri, methodName, typeName, instArgs, args, methodSignature, callContext, properties));
        }