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

  • Home
  • SEARCH
  • 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 8537423
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T10:53:55+00:00 2026-06-11T10:53:55+00:00

How does CQRS handle post-conditions on immediately consistent models? I realise something like this

  • 0

How does CQRS handle post-conditions on immediately consistent models? I realise something like this is irrelevant on an eventually consistent system w/ event sourcing etc. But if I just wanted to apply vanilla CQRS to a simple interface, how would I write my post-conditions? Is the idea of CQRS to always assume eventual consistency?

CRUD:

IDictionary
{
   void Set(string key, object value); // Ensures: Get(key) == value
   object Get(string key);
}

CQRS:

IDictionaryQueries
{
   object Get(string key);
}

IDictionaryCommands
{
   void Set(string key, object value); // Ensures: ???
}
  • 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-11T10:53:56+00:00Added an answer on June 11, 2026 at 10:53 am

    Think about it in therms of transactional behaviour and boundaries. In immediately consistent models the Set and Get are going to be executed in the same transaction. The “transaction” is going to ensure that the actual storage behind the two interfaces is going to always be consistent. This is your guarantee that after calling the Set method, the Get method is going to return the expected value. This guarantee is kept as long as the implementation does not introduce a decoupling mechanism, like messaging.

    With eventual consistency the two operations are performed in different transactions and the only guarantee is that eventually the Get is going to return the expected value.

    Now in therms of code-contracts, and i must say that i’m not very familiar with them, i does kind of defeat the purpose of CQRS to have a post-condition ( on a Command operation ) that relies on a Query like operation. Maybe your post-condition should not be expressed in therms of the Get operation, but more like “The Command was executed successful”. This would be your post-condition at interface level. At implementation level where you will most probably have the same class implementing both interfaces you could express the post condition based on the Get operation.

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

Sidebar

Related Questions

Does anybody know why this function, when passed an invalid date (e.g. timestamp) to
Does anyone know how to make this code stop the knob from rotating past
Does this line of Perl really do anything? $variable =~ s/^(\d+)\b/$1/sg; The only thing
Does anyone know why this bean is getting instantiated multiple times? I only ever
Does AtomicInteger provide any kind of fairness guarantee? like first-come-first-serve execution order of threads
Does the following function cause stack overthrow eventually? var isFinish= false; function foo(){ //
Does Google force employees who have offers from Facebook to leave immediately?
Does anyone use have a good regex library that they like to use? Most
Does this code get called for every object creation in Java, because every object
Does anyone know what this message means (or when it raises)? CFURLCopyResourcePropertyForKey failed because

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.