Add optimistic concurrency (RowVersion) to user-editable entities
Nobody has claimed this yet.
- Dominant language
- HTML
- Stars
- 10
- Forks
- 0
- Avg merge
- 2h 52m
- Merged PRs (30d)
- 20
Description
Tier 2 — correctness
Problem
No entity carries a concurrency token, and the update services copy every field from the incoming object onto the tracked entity. Two browser tabs — very common in a Blazor Server app, and the resource list is also edited from dialogs — silently overwrite each other, last write wins. Drag-and-drop reordering makes this worse because it rewrites CustomOrder across many rows at once.
Evidence
LearnStack.Core/Data/Models/LearningResource.cs— noRowVersionLearnStack.Core/Services/LearningResourceService.cs:105-130— wholesale field copyLearnStack.Core/Services/LearningResourceService.cs:157-176— bulkCustomOrderrewrite
Proposed fix
- Add
[Timestamp] public byte[]? RowVersion { get; set; }toLearningResourceandContentIdea. - Handle
DbUpdateConcurrencyExceptionin the services and surface a "this item changed elsewhere" message instead of silently overwriting.
Acceptance criteria
- Concurrent edits produce a conflict message rather than silent data loss
- Reordering is resilient to a stale client-side list
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with LearnStack.Core/Data/Models/LearningResource.cs and LearnStack.Core/Services/LearningResourceService.cs:105-130, then trace the service's bulk reorder path at lines 157-176. Identify the corresponding ContentIdea model and service, and verify how DbUpdateConcurrencyException can reach the user-facing flow. Done means concurrent edits show a conflict message and stale client-side reordering no longer silently loses changes.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- csharp
- Domain
- backend, databases
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 48/100