本文整理汇总了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);
}
}
示例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);
}
}
示例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);
}
}
}
示例4: TestBeginThrowsExceptionWhenDisposed
public void TestBeginThrowsExceptionWhenDisposed()
{
var transaction = new Transaction(this.sesid);
transaction.Dispose();
transaction.Begin();
}
示例5: TestDoubleTransactionBeginThrowsException
public void TestDoubleTransactionBeginThrowsException()
{
using (var transaction = new Transaction(this.sesid))
{
transaction.Begin();
}
}