0

I have a question with regards to using the unit of work with the repository to handle transactions across multiple modules.

I have two modules called customer and warehouse and they both have their own databases.

At the moment I use the unit of work to update each module independently of each other. What I want now is to update both modules at the same time and if one of them is invalid then neither are committed.

Is this possible with the unit of work pattern?

tereško
  • 58,060
  • 25
  • 98
  • 150
user1180223
  • 111
  • 8

1 Answers1

0

I don't think a true unit of work pattern is possible in this scenario. I'd be looking to a service class that used both repositories.

Edit - okay it might be possible - this guy refers to a solution that looks plausible:

Unit of Work with multiple Data Sources?

I'd still look at just wrapping the existing repositories in service/manager classes and keeping things simple.

Community
  • 1
  • 1
Mark D
  • 5,368
  • 3
  • 25
  • 32