Exemplo n.º 1
0
        public void Merge(Result result)
        {
            // This will copy the results from the 'BatchResult' back to the original structure.  The 'ResultBatch' returned
            // from the execution of the batch only has the return codes and the exceptions.  This will correlate and copy
            // those values back into the original batch so the caller will have the impression that the entire structure made
            // the round trip to the server and back.  The 'ResultBatch' was designed to minimize the amount of traffic and
            // deserializing that had to be done during the trip to the server and back.
            foreach (Result.Transaction resultTransaction in result.Transactions)
            {
                // Correlate the current result transaction with the original transaction.
                Batch.Transaction batchTransaction = this.Transactions[resultTransaction.Index];

                // Copy each of the transaction level exceptions back into the original structure.
                foreach (Exception exception in resultTransaction.Exceptions)
                {
                    batchTransaction.Exceptions.Add(exception);
                }

                foreach (Result.Method resultMethod in resultTransaction.Methods)
                {
                    // Correlate the original method with the resulting method.
                    Batch.Method batchMethod = batchTransaction.Methods[resultMethod.Index];

                    // Copy each of the output parameters back into the original method.
                    batchMethod.Results = resultMethod.Results;

                    // Copy each of the exceptions back into the original method.
                    foreach (Exception exception in resultMethod.Exceptions)
                    {
                        batchMethod.Exceptions.Add(exception);
                    }
                }
            }
        }
Exemplo n.º 2
0
 public Method(Batch.Method batchMethod)
 {
     // Initialize the object
     this.Index      = batchMethod.Index;
     this.Results    = batchMethod.Results;
     this.Exceptions = batchMethod.Exceptions.ToArray();
 }