Begin() public method

Begin a transaction. This object should not currently be in a transaction.
public Begin ( ) : void
return void
示例#1
0
 public void CreateRollbackAndBegin()
 {
     using (var transaction = new Transaction(this.sesid))
     {
         Assert.IsTrue(transaction.IsInTransaction);
         transaction.Rollback();
         Assert.IsFalse(transaction.IsInTransaction);
         transaction.Begin();
         Assert.IsTrue(transaction.IsInTransaction);
     }
 }
示例#2
0
 public void CreateCommitAndBegin()
 {
     using (var transaction = new Transaction(this.sesid))
     {
         Assert.IsTrue(transaction.IsInTransaction);
         transaction.Commit(CommitTransactionGrbit.None);
         Assert.IsFalse(transaction.IsInTransaction);
         transaction.Begin();
         Assert.IsTrue(transaction.IsInTransaction);
     }
 }
        /// <summary>
        /// Generate some logs. This is used by tests that do backups.
        /// </summary>
        /// <param name="sesid">The session to use.</param>
        /// <param name="dbid">The database to use to generate the logs.</param>
        private static void GenerateSomeLogs(JET_SESID sesid, JET_DBID dbid)
        {
            if (EsentVersion.SupportsWindows7Features)
            {
                for (int i = 0; i < 10; ++i)
                {
                    Api.JetCommitTransaction(sesid, Windows7Grbits.ForceNewLog);
                }
            }
            else
            {
                using (var transaction = new Transaction(sesid))
                {
                    JET_TABLEID junkTable;
                    Api.JetCreateTable(sesid, dbid, "junk", 1, 100, out junkTable);
                    JET_COLUMNID binaryColumn;
                    Api.JetAddColumn(sesid, junkTable, "column", new JET_COLUMNDEF { coltyp = JET_coltyp.LongBinary }, null, 0, out binaryColumn);

                    byte[] data = new byte[1023];
                    for (int i = 0; i < 256; ++i)
                    {
                        using (var update = new Update(sesid, junkTable, JET_prep.Insert))
                        {
                            Api.JetSetColumn(
                                sesid,
                                junkTable,
                                binaryColumn,
                                data,
                                data.Length,
                                SetColumnGrbit.IntrinsicLV,
                                null);
                            update.SaveAndGotoBookmark();
                        }

                        transaction.Commit(CommitTransactionGrbit.LazyFlush);
                        transaction.Begin();
                    }

                    Api.JetCloseTable(sesid, junkTable);
                    Api.JetDeleteTable(sesid, dbid, "junk");
                    transaction.Commit(CommitTransactionGrbit.LazyFlush);
                }
            }
        }
示例#4
0
 public void TestBeginThrowsExceptionWhenDisposed()
 {
     var transaction = new Transaction(this.sesid);
     transaction.Dispose();
     transaction.Begin();
 }
示例#5
0
 public void TestDoubleTransactionBeginThrowsException()
 {
     using (var transaction = new Transaction(this.sesid))
     {
         transaction.Begin();
     }
 }
示例#6
0
 public void Begin()
 {
     //_undoRedoSession = new UndoRedoSession();
     _dbTransaction.Begin();
 }