/DB

Changelog

What changed in Socigy.OpenSource.DB v0.2.0 — diagnostics/OpenTelemetry, a testable database context, and a hardened expression parser.

updated 5 Jun 20261 min readv0.2.0View as Markdown
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.duration histogram, and command/error counters — all under the source/meter name Socigy.OpenSource.DB.
  • Structured SQL logging via ILogger with 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}, and I{Table}Set — with ExecuteAsync/ExecuteTransactionAsync unit-of-work scopes, first-class transactions, streaming ForEachAsync, and configurable connection lifetime. Callers never pass a DbConnection, and services are fully mockable.
  • Expression parser support for more operators and types: bool-column predicates, Nullable<T>.HasValue/.Value, case-insensitive ILIKE (via ToLower()/ToUpper()), string.Equals, string.IsNullOrEmpty, arithmetic operators, and null-coalescing (?? to COALESCE).
Changed
  • Unsupported LINQ expressions now throw NotSupportedException with 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.
  • LIKE patterns are now escaped. Contains/StartsWith/EndsWith escape %, _ and \ and append ESCAPE '\', 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.WriteLine diagnostics 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.