How to prove the consistency of aggregates in DDD (technically)?

Keeping our aggregate consistent is so important when developing web applications using DDD.

I worked in the past in a web application (without DDD), where we tried to ensure transactional consistency of our data. So, we used the Serializable transaction level, and it was a nightmare for our team, because the performance of our application was so poor, and our users reported many lock problems.

Now I am working on a web application that implements the principles of DDD, and I need to ensure the consistency of our aggregates.

I read here http://geekswithblogs.net/Optikal/archive/2013/04/07/152643.aspx that optimistic concurrency / locking is one way to achieve this throw assigning a version or timestamp to our aggregate to check it.

My first question is how to achieve optimistic concurrency using C # and an entity structure combined with Sql Server, including the whole process from start to finish, and where to store this column / flag if we take the order and position example that Eric Evans gave in his book?

My second question: what common strategies are used to ensure the consistency of units in case of race conditions?

I would appreciate any piece of code or link.

+4
source share
1

, concurrency # Sql Server, , /, , ?

, . , JSON . NoSQL .

(.. ), , . .

: ?

. ( , -), .

0

Source: https://habr.com/ru/post/1686360/


All Articles