© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
C#C
C#•11mo ago•
26 replies
Thanacio

Dapper - Unit of work between 2 repositories

I need to keep a common transaction between 2 repositories, but I'm not sure who will be responsible for rolling it back in case of failure.
Those 2 repositories do share connection and transaction via parent, but one of them has to commit the transaction.
How do people usually go about this?

- Do I make it so that the service is responsible for coordinating the repositories? I'm too new but this sounds wrong because a transaction commit/rollback is the responsibility of the database layer.
- Do I call one repository method through another? This would mean injecting a repository, and I read that it's bad practice.

Sorry, I'm new to Dapper and Unit of Work as a pattern.
C# banner
C#Join
We are a programming server aimed at coders discussing everything related to C# (CSharp) and .NET.
61,871Members
Resources

Similar Threads

Was this page helpful?
Recent Announcements

Similar Threads

❔ Dapper Unit Of Work
C#CC# / help
3y ago
✅ Unit of Work for just Repositories or Services as well?
C#CC# / help
2y ago
How does Dapper work
C#CC# / help
2y ago
❔ Dapper
C#CC# / help
3y ago