Change Log
4.2.1 (02/24/2026)
Full Changelog
Merged Pull Requests
Use AsyncLocal instead of ThreadStatic for SqlStatement.Current (02/24/2026) #79 (seesharper)
Summary
SqlStatement.Currentwas annotated with[ThreadStatic], which stores values per OS thread- With
async/await, continuations can resume on a different thread pool thread (especially after.ConfigureAwait(false)), causingSqlStatement.Currentto benullor stale in the async read path - Replaced with
AsyncLocal<string>, which flows throughExecutionContextand correctly tracks the value acrossawaitboundaries - Public API is unchanged — callers read/write
SqlStatement.Currentthe same way
Test plan
- All 225 existing tests pass
- Verify async reads (
ReadAsync,ReadWithoutNavigationPropertiesAsync) correctly use the cache key across thread switches
🤖 Generated with Claude Code