GetResult(bool ok) { var ret = new Object_Ice_invokeResult(); if (Proxy.IceReference.GetMode() == InvocationMode.Twoway) { ret.OutEncaps = Is !.ReadEncapsulation(out EncodingVersion _); } else { ret.OutEncaps = null; } ret.ReturnValue = ok; return(ret); }
/// <summary> /// Invokes an operation dynamically. /// </summary> /// <param name="prx">The proxy to invoke the operation.</param> /// <param name="operation">The name of the operation to invoke.</param> /// <param name="idempotent">True if this operation is idempotent, and false otherwise.</param> /// <param name="inEncaps">The encoded in-parameters for the operation.</param> /// <param name="outEncaps">The encoded out-paramaters and return value /// for the operation. The return value follows any out-parameters.</param> /// <param name="context">The context dictionary for the invocation.</param> /// <returns>If the operation completed successfully, the return value /// is true. If the operation raises a user exception, /// the return value is false; in this case, outEncaps /// contains the encoded user exception. If the operation raises a run-time exception, /// it throws it directly.</returns> public static bool Invoke(this IObjectPrx prx, string operation, bool idempotent, byte[] inEncaps, out byte[]?outEncaps, Dictionary <string, string>?context = null) { try { Object_Ice_invokeResult result = prx.IceI_ice_invokeAsync(operation, idempotent, inEncaps, context, null, CancellationToken.None, true).Result; outEncaps = result.OutEncaps; return(result.ReturnValue); } catch (AggregateException ex) { throw ex.InnerException; } }