Skip to content

Pitfalls of using Petapoco async api inside using. #724

@mercurial-moon

Description

@mercurial-moon

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions