Prasanna Kumar J
Prasanna Kumar J

Reputation: 1618

Difference between Database.BeginTransaction() and Database.GetTransaction() Using petapoco?

using (var trn =database.GetTransaction())
{
    database.BeginTransaction();//it is required or not?
    database.Save(Table);
    trn.complete()
}

what is use of BeginTransaction() in petapoco?

Upvotes: 0

Views: 612

Answers (1)

Eduardo Molteni
Eduardo Molteni

Reputation: 39453

GetTransaction() create a new transaction object, that executes BeginTransaction() so there no need to call it.

enter image description here

enter image description here

I think the you can use BeginTransaction() when you need more granular transaction control. I've never used it independently.

Upvotes: 1

Related Questions