Domain Driven Design: Aggregate root & Sub Aggregate roots

In my project, i am finding the need to break my aggregate in a hierarchical fashion, with top root level aggregate, which ensures consistency of rules at root level, and then my objects under the...

Communicating Concurrency Conflicts to the Application Layer

When communicating concurrency conflicts to your application layer, is there an alternative to using exceptions that also respects the principle of Command-Query Separation, or are exceptions the...

Self Tracking Entities versus timestamp column in database

In an optimistic concurrency scenario fo a web-app, I am considering to give each table the timestamp column (sqlserver), comparable to a guid. Linq to entities will then generate sql update...

Transactions, locks, isolation levels

I have a few questions regarding subject from the title. First of all, lets assume that we work with JDBC, and there we have 2 transactions T1 and T2. In T1 we execute select statement on one...

Getting Affected Rows by UPDATE statement in RAW plpgsql

This has been asked multiple times here and here, but none of the answers are suitable in my case because I do not want to execute my update statement in a PL/PgSQL function and use GET...

Update Database using Entity Framework having primary key on multiple Columns

Following is the error message I get: Store update, insert, or delete statement affected an unexpected number of rows (0). Entities may have been modified or deleted since entities were loaded....

Use EF to delete a record by id, if id does not exist, an exception is thrown

The code looks like this: try { Student stu = new Student() { ID = id }; db.Entry(stu).State = EntityState.Deleted; int result = db.SaveChanges(); } catch (DataException e) { } The...

Entity framework update failure

I want to update a row in EF: Case newCase = new Case(...); dbContext.Entry(newCase).State = EntityState.Modified; dbContext.SaveChanges(); When updating I have this message: Database operation...

How to use UserManager synchronously?

In one of my IDatabaseInitializer in Seed method given my DbContext I insert initial data to DB. Among other things there are some users to be initialized. But as far as I use...

Mongoose optimistic concurrency with version number

Is there any way to force mongoose to always validate document versions on save? As far as I can tell, the default behavior enforces the version number only when modifying arrays in the document....

Can't delete a row using entity framework

The problem that I'm having is that I can't delete a row when using entity. I'm able to find the row, but the error I get the next error: Additional information: Store update, insert, or delete...

Difference between snapshot, pessimistic, and optimistic transactions

I have been trying to understand these types of database transaction. From my understanding snapshot transaction maintain concurrency by sending a relatively small amount of time old snapshot of...

RowVersion implementation on Entity Framework for PostgreSQL

I am using Entity Framework 6 with PostgreSQL. I have an entity in which I want to prevent concurrency issues, following this documentation I added a RowVersion property with [Timestamp]...

TransactionFailedError (too much contention...) when reading (cross-group) entities from datastore

I’m investigating again the unexpected occurrence of TransactionFailedError (too much contention on these datastore entities... in cases, where the code only reads entity groups that are blamed...

What is the difference between a resourceVersion and a generation?

In Kubernetes object metadata, there are the concepts of resourceVersion and generation. I understand the notion of resourceVersion: it is an optimistic concurrency control mechanism—it will...

Database operation expected to affect 1 row(s) but actually affected 0 row(s)

I'm trying to insert records in two tables, but getting the exception. Could you please help me to resolve the issue. First I tried the below code. await _testRepository.InsertAsync(test); await...

EF Core 2.1.1 "DbUpdateConcurrencyException" when calling SaveChangesAsync() using IBM DB2

I'm trying to switch my database provider from SqlServer to Db2. Now I'm facing the issue that when I call: await SaveChangesAsync() EF drops the error DbUpdateConcurrencyException: Database...

Microservices - Is event store technology (in event sourcing solutions) shared between all microservices?

As far as my little current experience allows me to understand, one of the core concepts about "microservice" is that it relies on its own database which is independent from other...

Concurrent updates in DynamoDB, are there any guarantees?

In general, if I want to be sure what happens when several threads make concurrent updates to the same item in DynamoDB, I should use conditional updates (i.e.,"optimistic locking"). I know that....

Code First EF Concurrency Token with Guid

I am trying to use a GUID as the concurrency token but every time I try to insert a record there is an exception about null value not being able to be added. Generated SQL and Exception...

What exactly is the primary_term in elastic search?

After reading a lot of documentation, I understood that the primary_term along with the sequence_number are used for optimistic concurrency control in order to prevent an older version of a...

ASP.NET MVC Core Error -> DbUpdateConcurrencyException: Database operation expected to affect 1 row(s) but actually affected 0 row(s)

I know there are a few questions of this error posted but none of them helped me! I'm using ASP.NET MVC Core and Identiy and I'm trying to update Roles. But it's getting a bit nerve wrecking...

Are stored procedures in Cosmos DB automatically retried on conflict?

Stored procedures in Cosmos DB are transactional and run under isolation snapshop with optimistic concurrency control. That means that write conflicts can occur, but they are detected so the...

@Version annotation does not work correctly

I use Java Persistence versioning in Spring Boot project for handling optimistic concurrency control. I have 3 model: Process, Amazing and Contract. Process @Entity @Table(name =...

ASP.net Core 3 IdentityErrorDescriber Error Messages

I have an ASP.net Core 3.1 web application. I'm trying to customize the error message for "Invalid User Name" when creating a new User. I've created a custom class "CustomIdentityErrorDescriber"...

ASP.Net Core with EF Core and CosmosDB .NET 5 - IdentityRole issue

My Question is similar to this one. https://stackoverflow.com/questions/63291717/asp-net-core-with-ef-core-and-cosmosdb-identityrole-issue The provided answer does not work. It creates other...

Azure Storage Queue via REST API c# using Shared Key Authentication

I am trying to call Azure Storage queue using REST API, but I am getting an error The MAC signature found in the HTTP request 'UCiypkoySXueF4scXt+EqQESf5VXmAVLJUA93+3W10M=' is not the same as...

Is optimistic locking enough to secure operations such as funds transfer?

In the following example we may run into a concurrency error where if the sender decides to send funds to 2 different receivers in the same time then both receivers may get the money while the...

Why does HTTP PUT from Angular 9 service CREATE a new DB entity instead of UPDATING original? - cannot read property 'id' of null & concurrency error

I am new to Angular SPA and MVC in general, and I am currently working in Visual Studio 2017 on a MVC Core 2.2 Web Application project with EF Core ORM (the Model) and an Angular 9 front-end. The...

Cannot add records to sqlite table: Database operation expected to affect 1 row(s) but actually affected 0 row(s)

I use EntityFramework SQLite and got stuck with weird bug. I searched for the similar problems, but no solution suits my case. In my real project it does not work at all. (with the same exception)...