Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update Concurrency-Check.md #18908

Merged
merged 3 commits into from
Feb 1, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 6 additions & 4 deletions docs/en/Concurrency-Check.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ public interface IHasConcurrencyStamp
* While a new record is **creating**, if the entity implements the `IHasConcurrencyStamp` interface, ABP Framework automatically sets a unique value to the **ConcurrencyStamp** property.
* While a record is **updating**, ABP Framework compares the **ConcurrencyStamp** property of the entity with the provided **ConcurrencyStamp** value by the user and if the values match, it automatically updates the **ConcurrencyStamp** property with the new unique value. If there is a mismatch, `AbpDbConcurrencyException` is thrown.

> If there is a unit of work, you need to call the [SaveChangesAsync](./Unit-Of-Work.md#savechangesasync) method to get the generated `ConcurrencyStamp` when creating or updating.

**Example: Applying Concurrency Control for the Book Entity**

Implement the `IHasConcurrencyStamp` interface for your entity:
Expand Down Expand Up @@ -74,8 +76,8 @@ public class BookAppService : ApplicationService, IBookAppService
book.ConcurrencyStamp = input.ConcurrencyStamp;

//set other input values to the entity ...

await BookRepository.UpdateAsync(book);
//use autoSave: true to get the latest ConcurrencyStamp
await BookRepository.UpdateAsync(book, autoSave: true);
}
}
```
Expand Down Expand Up @@ -134,8 +136,8 @@ public class BookAppService : ApplicationService, IBookAppService
book.ConcurrencyStamp = input.ConcurrencyStamp;

//set other input values to the entity ...

await BookRepository.UpdateAsync(book);
//use autoSave: true to get the latest ConcurrencyStamp
await BookRepository.UpdateAsync(book, autoSave: true);
}
}
```
Expand Down
Loading