Transaction Storage
With the unified specification and encoding of transactions, you need to consider how to store a transaction in the next step. First, an operation has its unique encoding, which stores the ID encoding value through the string type. Second, you need to store the parameter list. Because each operation requires different parameters, using list <string> is the preferred solution.
Code implementation:
/// <Summary> /// list of all method numbers and parameters of a method during an operation // </Summary> [serializable ()] public class transactionentity {public transactionentity () {transactionid = new list <string> (); transactionparam = new list <object []> (); success = new list <bool> () ;}/// <summary> /// clear the internal information /// </Summary> Public void clear () {transactionid. clear (); transactionparam. clear (); success. clear () ;}// the number of each method, which is equivalent to the key private list <string> m_transactionid; public list <string> transactionid {Get; set;} In hashtable ;} // The parameter list corresponding to the Method number, which is equivalent to the value private list <object []> m_transactionparam; public list <object []> transactionparam {Get; set;} In hashtable ;} // whether the corresponding method is successfully executed private list <Boolean> m_success; public list <Boolean> success {Get; Set ;}}
Structure entity class of a transaction
Structure of a transaction entity
A transaction contains many atomic operations. Each atomic operation corresponds to its own parameter list. In addition, each atomic operation is followed by a successful representation. After a transaction is executed, the program automatically checks whether each operation is successful. If not, the entire operation will be rolled back and the transaction is completed.