Changelog
What changed in Socigy.OpenSource.DB v0.2.0 — diagnostics/OpenTelemetry, a testable database context, and a hardened expression parser.
4 June 2026
Socigy.OpenSource.DBv0.2.0stable
Added
- Diagnostics & OpenTelemetry. Every executed SQL statement now emits an OpenTelemetry activity (with database semantic-convention tags), a
db.client.operation.durationhistogram, and command/error counters — all under the source/meter nameSocigy.OpenSource.DB. - Structured SQL logging via
ILoggerwith the SQL text, parameters and duration. Parameter value capture is opt-in (CaptureParameterValues) with a redaction hook and truncation. - Testable database context. A generated, fully interface-based facade —
ISocigyDatabaseFactory<I{Db}>,I{Db}, andI{Table}Set— withExecuteAsync/ExecuteTransactionAsyncunit-of-work scopes, first-class transactions, streamingForEachAsync, and configurable connection lifetime. Callers never pass aDbConnection, and services are fully mockable. - Expression parser support for more operators and types: bool-column predicates,
Nullable<T>.HasValue/.Value, case-insensitiveILIKE(viaToLower()/ToUpper()),string.Equals,string.IsNullOrEmpty, arithmetic operators, and null-coalescing (??toCOALESCE).
Changed
- Unsupported LINQ expressions now throw
NotSupportedExceptionwith a clear message instead of silently emitting invalid SQL. If you relied on an unsupported operator slipping through, it now fails fast at translation time. LIKEpatterns are now escaped.Contains/StartsWith/EndsWithescape%,_and\and appendESCAPE '\', so values containing wildcards match literally. Queries that accidentally depended on unescaped wildcards may return different rows.- License changed to MPL-2.0 (from the previous MIT-with-non-commercial terms).
Fixed
- Removed stray
Console.WriteLinediagnostics from the query parser and the generated query builder. - The generated query builder no longer times only preparation; actual execution duration is measured and reported through the diagnostics pipeline.