当前位置: 首页>>代码示例>>C#>>正文


C# Transaction.Begin方法代码示例

本文整理汇总了C#中Microsoft.Isam.Esent.Interop.Transaction.Begin方法的典型用法代码示例。如果您正苦于以下问题:C# Transaction.Begin方法的具体用法?C# Transaction.Begin怎么用?C# Transaction.Begin使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Microsoft.Isam.Esent.Interop.Transaction的用法示例。


在下文中一共展示了Transaction.Begin方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: CreateRollbackAndBegin

 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);
     }
 }
开发者ID:ayende,项目名称:managed-esent,代码行数:11,代码来源:TransactionTests.cs

示例2: CreateCommitAndBegin

 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);
     }
 }
开发者ID:ayende,项目名称:managed-esent,代码行数:11,代码来源:TransactionTests.cs

示例3: GenerateSomeLogs

        /// <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);
                }
            }
        }
开发者ID:jtmueller,项目名称:ravendb,代码行数:49,代码来源:DatabaseFileTestHelper.cs

示例4: TestBeginThrowsExceptionWhenDisposed

 public void TestBeginThrowsExceptionWhenDisposed()
 {
     var transaction = new Transaction(this.sesid);
     transaction.Dispose();
     transaction.Begin();
 }
开发者ID:jtmueller,项目名称:ravendb,代码行数:6,代码来源:TransactionTests.cs

示例5: TestDoubleTransactionBeginThrowsException

 public void TestDoubleTransactionBeginThrowsException()
 {
     using (var transaction = new Transaction(this.sesid))
     {
         transaction.Begin();
     }
 }
开发者ID:jtmueller,项目名称:ravendb,代码行数:7,代码来源:TransactionTests.cs


注:本文中的Microsoft.Isam.Esent.Interop.Transaction.Begin方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。