コード例 #1
0
        //we can take a look the standard XA/Open interface.
        public XaResponse Prepare(Transaction context)
        {
            WaitForReady();
            ++NumberPrepares;
            if (NumberPrepares >= this.VoteNoOnPrepare && this.VoteNoOnPrepare != 0)
            {
                return(XaResponse.XAER_RMERR);
            }

            _transactionStorage.Prepare(context);
            return(XaResponse.XA_OK);
        }
コード例 #2
0
 public void CommitTest()
 {
     Transaction context = new Transaction();
     Transaction context1 = new Transaction();
     RID rid = new RID(RID.Type.FLIGHT, Guid.NewGuid().ToString().Substring(0, 24));
     var db = CreateDatabase();
     TransactionStorage tr = new TransactionStorage(db);
     tr.Write(context, rid, new Resource(rid, 10, 11));
     Resource res = tr.Read(context1, rid);
     Assert.IsNull(res);
     tr.Prepare(context);
     tr.Commit(context);
     res = tr.Read(context, rid);
     Assert.AreEqual(11, res.getPrice());
 }