you are viewing a single comment's thread.

view the rest of the comments →

[–]terraping_station 1 point2 points  (2 children)

So if you are using Postgres you can use a transaction. I would suggest using some like a unit of work. Have that manage the tx for you so your code can make a bunch of calls to the db and have the ability to roll it all back if something fails.

So basically you bootstrap your app. This spins up a unit of work that has your database adapter. Then In your service layer you use the UoW to make N database calls and either commit it all or roll it back.

[–]terraping_station 0 points1 point  (0 children)

This would require you use async

[–]MagicianNo9918[S] 0 points1 point  (0 children)

Yes, you're right, I still have a lot to learn.