4 replies
July 2023

Don_Rolling

I’m really wary of “magic” middleware that manages database transactions. It feels like a violation of separation of concerns when http middleware takes over the concern of database transactions. I’m not saying that it won’t work, but I generally do not want to deal with databse code that leaks out of the repository layer.

3 replies
July 2023 ▶ Don_Rolling

DavidBoike in Particular

The article isn’t about HTTP middleware to manage database transactions. The article is talking about how to make database transactions initiated by the web tier consistent with messages sent to the backend so that the entire operation is atomic. You can’t do that with just a database transaction in the repository layer.

The alternative is to only send a message from the web tier and do all the database work on the backend.

July 2023

ramonsmits in Particular

That isn’t happening as NServiceBus doesn’t know anything about your business data. The NServiceBus outbox table needs to share the same database to share the same transaction that your repository object is also using and that is it.

August 2023 ▶ Don_Rolling

danielmarbach

Curious to hear from you @Don_Rolling how you manage the unit of work that surrounds your repository layer?