Skip to content

Instantly share code, notes, and snippets.

@zabulus
Created January 30, 2016 19:25
Show Gist options
  • Save zabulus/1e46010094e1b6678729 to your computer and use it in GitHub Desktop.
Save zabulus/1e46010094e1b6678729 to your computer and use it in GitHub Desktop.
public static DbTransaction CreateWriteTransaction(this System.Data.Entity.Database self)
{
DbTransaction ret;
self.Connection.Open();
if (self.Connection is FbConnection)
{
FbTransactionOptions options = new FbTransactionOptions() { TransactionBehavior = FbTransactionBehavior.Write | FbTransactionBehavior.ReadCommitted | FbTransactionBehavior.NoRecVersion | FbTransactionBehavior.Wait };
ret = ((FbConnection)self.Connection).BeginTransaction(options);
}
else
{
ret = self.Connection.BeginTransaction();
}
self.UseTransaction(ret);
return ret;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment