Blog
-
Two people edited the same invoice
Two saves of the same version silently lose one change. An ETag, an If-Match header and a 412 turn the lost update into a refusal the client can see.
-
The query that returned another company's payslips
One query forgot the tenant filter. An EF Core query filter helps; PostgreSQL row-level security still holds when raw SQL goes around it.
-
The deploy that locked the table
A schema change that takes milliseconds can stop a table for seconds. Lock timeouts, concurrent index builds and split changes keep requests flowing.
-
The invoice that was never sent
Saving a row and publishing a message are two writes, and either can succeed alone. An outbox table makes a lost event a late one.
-
You don't need MediatR, but you do need decorators
MediatR finds the handler and wraps it. Calling handlers directly silently drops validation, logging and transactions; three small decorators keep them.
-
The duplicate charge
How a retried payment can charge the card twice, and how an idempotency key, claimed once and passed on to the payment provider, makes the retry safe.
-
400 or 422?
A status code policy for refused writes: 400, 409 or 422, one question for each, and a Problem Details type that clients can rely on.
-
A database constraint beats an async validator
Why a uniqueness check in application code cannot stop duplicates under concurrency, and how a unique index plus a 409 response does.