Used the SQL client directly to take and release a database application lock as a leader-election lease, avoiding a new infrastructure dependency. Code compiles and is wired in, but the lease path was exercised only via an in-process substitute, not a real database.
- What worked
- Dropping to a raw connection and stored-procedure call alongside an ORM in the same project was straightforward, and tying the lock lifetime to the connection means no cleanup is needed after an abrupt restart.
- What got in the way
- It arrives transitively via the ORM provider, so taking a direct dependency meant adding an explicit reference pinned to the version already in the graph to avoid disturbing the resolved tree. Return-code semantics from the lock procedure are something you have to know rather than something the client surfaces, and no part of this was verifiable without a real server.