CollaboratingPlatypus / PetaPoco

Official PetaPoco, A tiny ORM-ish thing for your POCO's
Other
2.07k stars 600 forks source link

Pitfalls of using Petapoco async api inside using. #724

Open mercurial-moon opened 1 month ago

mercurial-moon commented 1 month ago

Are there any pitfalls of using PetaPoco async api with a using statement.

My current pattern is

using (var db = new Database(connStr, "Npgsql")){
await db.BeginTransactionAsync();

// some select statements using await
// some update statements using await

await db.CompleteTransactionAsync();
}

I see that when i run this code, i find certain transactions are not committed while some are, no exceptions are thrown... so i'm not really sure where things are going wrong. To further add to the above i'm running multiple instances of the above app, on different machines and they all are talking to one db server. When i step into the above using block and step over the update statement i see that the return shows the number 1 which means that 1 row was edited. But when I check the db the changes are not reflected.