Concurrency, deployment, diagnostics, capstone
TicketEditModel
carries the RowVersion it was loaded with as hidden state; TicketCommandService.SaveAsync restores it as
OriginalValue, so a stale save matches zero rows and throws DbUpdateConcurrencyException. The conflict
list is built with GetDatabaseValuesAsync and shown in ConflictDialog (field, your value, database value,
original) with Reload, and Overwrite for a Supervisor only. Deployment: the migration script in
artifacts/sql, environment-specific configuration, sensitive-data logging only in Development.
Built from Module 5 (the Module 6 performance work is not part of this capstone solution).
Run it
cd "LearnWisej-Samples/Data Binding with EF Core Course/Module 7/SupportDesk.Web"
dotnet run -f net10.0 --urls http://localhost:5407
The console prints the environment and whether sensitive-data logging is on; outside Development it says
migrations are not applied at startup. Tests: dotnet test SupportDesk.Tests.
What to try
The browser adds a Role selector (cboRole: Agent or Supervisor). There is no sign-in in this sample,
so it stands in for the user's role.
- Normal save: edit a ticket and Save; the editor closes and the grid refreshes.
- Conflict: open the same ticket in two browser tabs. Change the status in tab 1 and Save. Change the priority in tab 2 and Save: the conflict dialog lists the differing fields.
- Reload: the editor takes the database values and the new
RowVersion, and stays open. - Overwrite: hidden for an Agent; with Role = Supervisor it saves your values with the database's current
token as
OriginalValue, and the grid refreshes. - Deleted meanwhile: delete the ticket in one tab, Save it in the other: reported clearly, the editor closes and the grid refreshes.