Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8288125
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T12:13:00+00:00 2026-06-08T12:13:00+00:00

Inside every aggregate the consistence must be guaranteed. It is easy to do it

  • 0

Inside every aggregate the consistence must be guaranteed. It is easy to do it in the repository because I can always use transactions from the database or framework. I have doubts about what happens outside the repository. A service might need to work with more than one aggregate to process a request. There could be problems during the processing in the service or while the aggregates are persisted.

If something goes wrong during the processing in the service I could raise an exception. That way the operation will be atomic. This is my first concern. Is that a good practice? The problem I see is that it will be hard to recover from that. There will be no easy way to leave all the aggregates with the state they had before the failed operation.

The other problem I have is what happens if one of the aggregates fails to be persisted. How do I ensure the consistency of the information? Do I have to use database transactions outside the repositories? I was thinking that it might not be the best solution because I should not be thinking in the database when I am designing the domain model.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-08T12:13:02+00:00Added an answer on June 8, 2026 at 12:13 pm

    The solution to this is provided in the Unit of Work pattern – http://martinfowler.com/eaaCatalog/unitOfWork.html

    You can encapsulate as many aggregate root operations into a single UOW as you want. The unit of work concrete implementation can then contain its own commit and rollback logic, specific to the persistence method and technologies involved. For example, you deal with the TransactionScope object ( http://msdn.microsoft.com/en-us/library/system.transactions.transactionscope.aspx) if you were working in .NET.

    Here is a decent article on how to implement a basic UOW pattern – http://msdn.microsoft.com/en-us/magazine/dd882510.aspx

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Must every control in the Visual Studio WinForms toolbox descend from Control ? Does
I have a button inside every cell of my UITableView, but when the button
Javascript has a poorly constructed but convenient arguments variable inside every function, such that
this is the situation: I need horizontal scrolling, and table views inside every page.
For every comma inside a certain MYSQL row, I want to create x html
Has anyone every embeded the iPhone's Email program inside your own App? Let me
Every now and then I have a problem with SVN inside eclipse folder gets
Every 30 minutes their server generates an XML file with product inside, so my
I have a lot of button inside my application and for every button i
Zend Project with multiple modules and every modules have its own routes.ini defined inside

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.