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 8452795
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T11:35:40+00:00 2026-06-10T11:35:40+00:00

I am attempting to learn and apply the CQRS design approach (pattern and architecture)

  • 0

I am attempting to learn and apply the CQRS design approach (pattern and architecture) to a new project but seem to be missing a key piece.

My client application executes a query and retrieves a list of light-weight, read-only DTOs from the read model. The user selects an item and clicks a button to initiate some action. The action is performed by creating and sending the corresponding command object to the write model (where the command handler carries out the action, updates the data store, etc.) At some point, however, I need to update the UI to reflect changes to the state of the application resulting from the action.

How does the UI know when it is time to refresh the original list?

Additional Info

I have noticed that most articles/blogs discussing CQRS use MVC client apps in their examples. I am working on a Silverlight client right now and am beginning to wonder if the pattern simply doesn’t work in that case.

Follow-Up Question

After thinking more about Bartlomiej’s response and subsequent discussion, I am wondering about error handling in CQRS. Given that commands are basically fire-and-forget asynchronous operations, how do we report an error condition to the UI?

I see ‘refreshing the UI’ to take one of two forms:

  1. The operation succeeds, data has changed and the UI should be updated to reflect these changes
  2. The operation fails, data has not changed but the user should be notified of the failure and potential corrective actions.

Even with a Post-Redirect-Get pattern in an MVC, you can’t really Redirect until you know the outcome of the operation. None of the examples I’ve seen thus far address these real-world concerns.

  • 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-10T11:35:42+00:00Added an answer on June 10, 2026 at 11:35 am

    I’ve been struggling with similar issues for a WPF client. The re-query trigger for any data is dependent on the data your updating, commands tend to fall into categories:

    1. The command is a true fire and forget method, it informs the back-end of a state change but this change does not need to be reflected in the UI, or the change simply isn’t important to the UI.

    2. The command will alter the result of a single query

    3. The command will alter the result of multiple queries, usually (in my domain at least) in a cascading fashion, that is, changing the state of a single “high level” piece of data will likely affect many “low level” caches.

    My first trigger is the page load, very few items are exempt from this as most pages must assume data has been updated since it was last visited. Though some systems may be able to escape with only updating financial and other critical data in this way.

    For short commands I also update data when ‘success’ is returned from a command. Though this is mostly laziness as IMHO all CQRS commands should be fired asynchronously. It’s still an option I couldn’t live without but one you may have to if your implementation expects high latency between command and query.

    One pattern I’m starting to make use of is the mediator (most MVVM frameworks come with one). When I fire a command, I also fire a message to the mediator specifying which command was launched. Each Cache (A view model property Retriever<T>) listens for commands which affect it and then updates appropriately. I try to minimise the number of messages while still minimising the number of caches that update unnecessary from a single message so I’ll (hopefully) eventually end up with a shortlist of update reasons, with each ‘reason’ updating a list of caches.

    Another approach is simple honesty, I find that by exposing graphically how the system updates itself makes users more willing to be patient with it. On firing a command show some UI indicating you’re waiting for the successful response, on error you could offer to retry / show the error, on success you start the update of the relevant fields. Baring in mind that this command could have been fired from another terminal (of which you have no knowledge) so data will need to timeout eventually to avoid missing state changes invoked by other machines also.

    Noting the irony that the only efficient method of updating cache’s and values on a client is to un-separate the commands and queries again, be it through hardcoding or something like a hashmap.

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

Sidebar

Related Questions

I am new to programming but attempting to learn. Im running visual studio 2010
I am new to Ember and attempting to learn parts of it from the
I'm trying to learn python and I'm attempting a hangman game. But when I
I am attempting to learn how to develop on the Android platform but do
I'm following this tutorial attempting to learn XNA, but I'm having issues making my
I am very new to JSF (v2.0) and I am attempting to learn it
I'm attempting to learn WPF by unravelling a frankly nightmarish project written by the
I'm attempting to learn Spring MVC but have been spoiled by Grails. While I
I'm attempting to learn Ruby on Rails by creating a project and I can't
I am attempting to learn Ruby by converting a Java program to Ruby, but

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.