Professional .NET / EF Core Coding Prompt
Design and implement optimistic concurrency control using Entity Framework Core to ensure data integrity in a multi-user environment. Demonstrate how concurrent updates to the same database record are detected and resolved without locking resources.
Key Requirements:
- Configure a concurrency token (e.g.,
RowVersion/Timestamp) in an EF Core entity - Implement update logic that detects concurrency conflicts
- Gracefully handle
DbUpdateConcurrencyExceptionwith user-friendly resolution strategies - Show at least one conflict resolution approach (retry, client wins, or database wins)
- Ensure the solution follows clean coding and best practices
Expected Outcome:
A working EF Core implementation that safely manages concurrent data updates, prevents accidental overwrites, and provides a clear strategy for resolving conflicts in real-world enterprise applications.
Skill Level: Intermediate to Advanced
Use Cases: Enterprise applications, multi-user systems, interview preparation, backend architecture design
