internal object[] MapAsyncOutputs(MethodCall methodCall, object[] outs, ref object ret) { return MapOutputs(_endOutParams, methodCall, outs, ref ret); }
private object[] MapOutputs(ParameterInfo[] parameters, MethodCall methodCall, object[] outs, ref object ret) { if (ret == null && _returnParam != null) { ret = GetDefaultParameterValue(TypeLoader.GetParameterType(_returnParam)); } if (parameters.Length == 0) { return null; } object[] args = methodCall.Args; for (int i = 0; i < parameters.Length; i++) { if (outs[i] == null) { // the RealProxy infrastructure requires a default value for value types args[parameters[i].Position] = GetDefaultParameterValue(TypeLoader.GetParameterType(parameters[i])); } else { args[parameters[i].Position] = outs[i]; } } return args; }
internal object[] MapAsyncBeginInputs(MethodCall methodCall, out AsyncCallback callback, out object asyncState) { object[] ins; if (_inParams.Length == 0) { ins = Array.Empty<object>(); } else { ins = new object[_inParams.Length]; } object[] args = methodCall.Args; for (int i = 0; i < ins.Length; i++) { ins[i] = args[_inParams[i].Position]; } callback = args[methodCall.Args.Length - 2] as AsyncCallback; asyncState = args[methodCall.Args.Length - 1]; return ins; }
internal void MapAsyncEndInputs(MethodCall methodCall, out IAsyncResult result, out object[] outs) { outs = new object[_endOutParams.Length]; result = methodCall.Args[methodCall.Args.Length - 1] as IAsyncResult; }
internal object[] MapSyncInputs(MethodCall methodCall, out object[] outs) { if (_outParams.Length == 0) { outs = Array.Empty<object>(); } else { outs = new object[_outParams.Length]; } if (_inParams.Length == 0) return Array.Empty<object>(); return methodCall.Args; }
internal bool IsTaskCall(MethodCall methodCall) { if (_taskMethod == null) { return false; } Contract.Assert(methodCall != null); Contract.Assert(methodCall.MethodBase != null); return methodCall.MethodBase.Equals(_taskMethod); }
private MethodData GetMethodData(MethodCall methodCall) { MethodData methodData; MethodBase method = methodCall.MethodBase; if (_methodDataCache.TryGetMethodData(method, out methodData)) { return(methodData); } bool canCacheMessageData; Type declaringType = method.DeclaringType; if (declaringType == typeof(object) && method == typeof(object).GetMethod("GetType")) { canCacheMessageData = true; methodData = new MethodData(method, MethodType.GetType); } else if (declaringType.IsAssignableFrom(_serviceChannel.GetType())) { canCacheMessageData = true; methodData = new MethodData(method, MethodType.Channel); } else { ProxyOperationRuntime operation = _proxyRuntime.GetOperation(method, methodCall.Args, out canCacheMessageData); if (operation == null) { if (_serviceChannel.Factory != null) { throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new NotSupportedException(SR.Format(SR.SFxMethodNotSupported1, method.Name))); } else { throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new NotSupportedException(SR.Format(SR.SFxMethodNotSupportedOnCallback1, method.Name))); } } MethodType methodType; if (operation.IsTaskCall(methodCall)) { methodType = MethodType.TaskService; } else if (operation.IsSyncCall(methodCall)) { methodType = MethodType.Service; } else if (operation.IsBeginCall(methodCall)) { methodType = MethodType.BeginService; } else { methodType = MethodType.EndService; } methodData = new MethodData(method, methodType, operation); } if (canCacheMessageData) { _methodDataCache.SetMethodData(methodData); } return(methodData); }
private object InvokeGetType(MethodCall methodCall) { return(_proxiedType); }
private object InvokeTaskService(MethodCall methodCall, ProxyOperationRuntime operation) { Task task = TaskCreator.CreateTask(_serviceChannel, methodCall, operation); return(task); }