/DB

Changelog

What changed in Socigy.OpenSource.DB. Binary COPY bulk insert, scalar/affected/DTO procedure returns, database-first scaffolding, and Transit data-key envelope encryption with per-column profiles and OpenBao support in 0.3.3; runtime-named typed tables ([TableType] and DynamicTable) in 0.3.2; the database-context bulk insert plus scalar and aggregate API in 0.3.1; and 0.3.0's field encryption, rotating credentials, and HashiCorp Vault package.

updated 26 Jun 20266 min readv0.3.3View as Markdown
22 June 2026
Socigy.OpenSource.DBv0.3.3stable
Added
  • Binary COPY bulk insert. BulkCopy.InsertMultipleCopyAsync(rows, conn) (and DynamicTable<T>.InsertMultipleCopyAsync) load large batches via PostgreSQL's binary COPY ... FROM STDIN (FORMAT BINARY) — much faster than the parameterized multi-row insert and not bound by the 65,535-parameter limit. Values flow through the same per-column pipeline, so [Encrypted], JSON, and value-convertor columns are handled identically; NULLs are written as SQL NULL. COPY cannot use RETURNING, so DB-generated values are not propagated back — use InsertMultipleAsync when you need generated keys.
  • Scalar procedure returns. -- @returns scalar: T generates Task<T> for single-value queries (COUNT, MAX, EXISTS, …) over primitives, string, Guid, date/time types, and their nullable forms. NULL/empty → default(T), with numeric widening (e.g. COUNT's bigintint) handled.
  • Affected-row procedure returns. -- @returns affected generates Task<int> returning the rows a write affected, instead of the default Task<bool>.
  • DTO procedure returns. -- @returns: can now name a plain POCO/record (not only a [Table] type); the generator emits an AOT-safe, by-name materializer for projections and report shapes.
  • Database-first scaffolding. New CLI commands scaffold schema (live database → structure.json) and scaffold classes (database or structure.json → annotated [Table] C# classes), reusing the existing schema model so the result round-trips with generate.
  • Source-linked debug symbols. Embedded PDBs + SourceLink and deterministic CI builds, so consumers can step into library source.
  • Public-API surface tracking. The Core project tracks its public API (PublicAPI.*.txt) to guard against accidental breaking changes ahead of 1.0.
Changed
  • New generator diagnostics SCGDB019SCGDB022 validate the new procedure return directives (unsupported scalar type, conflicting or malformed @returns, and DTOs that cannot be mapped).
Fixed
  • Migration generation on Linux/headless builds. With no interactive name prompt, the generated migration's file and class name were derived from the multi-line schema-diff summary, producing an invalid name (embedded newlines and :). Headless builds now use a clean, deterministic {timestamp}_{prefix}_{hash} identifier.
  • Package metadata now points at the correct repository (github.com/Socigy-org/Socigy.OpenSource.DB).