dotnet / dotnet/EntityFramework.Docs

Cleanup organization of concurrency docs

Open
#3,205 2 comments 0 reactions 1 assignee Assigned to @AndriySvyryd View on GitHub
area-optimistic-concurrency
Dominant language
Mermaid
Stars
1.7k
Forks
2k
Avg merge
7d 23h
Merged PRs (30d)
16

Description

This article includes an example of a Concurrency token. This is the example:

```For example, we may want to configure LastName on Person to be a concurrency token.```

This is not a real world example. No-one would actually use LastName as a concurrency token.

The problem with this example is that then trying to understand the next Sql Example becomes much more difficult, as one then has to think "Oh, the lastname is just being used for the concurrency token"

```
UPDATE [Person] SET [FirstName] = @p1
WHERE [PersonId] = @p0 AND [LastName] = @p2;
```

I suggest the following:

```
For example, we may want to configure RowVersion on Person to be a concurrency token. (RowVersion is a ByteArray field which has been decorated with the TimeStamp attribute.)

UPDATE [Person] SET [FirstName] = @p1
WHERE [PersonId] = @p0 AND [RowVersion] = @p2;
```

This now is much easier to understand, at least for me. I ran across this today as I was trying to better understand concurrency in EntityFramework core and thought I would pass it along.

---
#### Document Details

⚠ *Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.*

* ID: 649fbab8-b960-6873-14bf-188d14757fee
* Version Independent ID: f5ee3135-54c8-689c-e28b-b203b376bd6f
* Content: [Handling Concurrency Conflicts - EF Core](https://docs.microsoft.com/en-us/ef/core/saving/concurrency)
* Content Source: [entity-framework/core/saving/concurrency.md](https://github.com/dotnet/EntityFramework.Docs/blob/main/entity-framework/core/saving/concurrency.md)
* Product: **entity-framework**
* Technology: **entity-framework-core**
* GitHub Login: @ajcvickers
* Microsoft Alias: **avickers**

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.