コード例 #1
0
 /// <summary>
 /// Converts the bytes to an action method.
 /// </summary>
 /// <param name="bytes">The bytes.</param>
 /// <returns></returns>
 public Expression <Action <IReceivedMessage <MessageExpression>, IWorkerNotification> > ConvertBytesToMethod(byte[] bytes)
 {
     using (_bytesToMethodTimer.NewContext())
     {
         return(_handler.ConvertBytesToMethod(bytes));
     }
 }
コード例 #2
0
        /// <summary>
        /// De-serializes and runs a compiled linq expression.
        /// </summary>
        /// <param name="receivedMessage">The received message.</param>
        /// <param name="workerNotification">The worker notification.</param>
        private void HandleAction(IReceivedMessage <MessageExpression> receivedMessage, IWorkerNotification workerNotification)
        {
            var target = _serializer.ConvertBytesToMethod(receivedMessage.Body.SerializedExpression);

            try
            {
                HandleAction(target.Compile(), receivedMessage, workerNotification);
            }
            catch (Exception error) //throw the real exception if needed
            {
                if (error.Message == "Exception has been thrown by the target of an invocation." &&
                    error.InnerException != null)
                {
                    throw error.InnerException;
                }
                throw;
            }
        }