A transaction boundary defines the scope within which a group of database operations succeeds or fails together.

My current understanding

A transaction should normally correspond to a meaningful application operation rather than an individual repository call.

Consider an operation containing several persistence steps:

T={O1,O2,O3}T = \{O_1, O_2, O_3\}

If O3O_3 fails, the application may need O1O_1 and O2O_2 to roll back as part of the same transaction.

Connections

This connects directly to Repository Pattern and the service layer.

Questions

  • When should transaction management be declarative?
  • How should nested application operations behave?
  • Where does Unit of Work fit?