Blog
Posts and series that take software and IT from the basics to advanced topics: from programming languages and databases to architecture and AI.
Audit Trail: Who Changed What, When and Why?
For a reliable audit trail, write changes with a SaveChangesInterceptor as per-property old/new values plus user, correlation id and reason, in the same transaction as the business data; mask personal data and make the table append-only. Cover paths that bypass the interceptor, such as ExecuteUpdate, with summary entries and a temporal table safety net.
Doing Soft Delete Right: IsDeleted, DeletedAt, Filtered Unique Indexes and Archive Tables
To do soft delete right, filter unique indexes with WHERE DeletedAt IS NULL, link records deleted in the same operation with a DeletionId, and answer KVKK/GDPR erasure requests with anonymization rather than soft delete. If restore isn't a real requirement, an archive table or hard delete plus audit is the simpler choice.
Enum or Lookup Table? Keeping Reference Data in Code and in the Database
Closed lists that drive code behavior (order status) should stay enums with a database mirror seeded via HasData and linked by an FK, while open lists managed by the business (the budget category on institutional orders) should live in a lookup table with IsActive and change without a deploy. The post shows the renumbering and string-enum rename traps with real output.
Exposing Ids: int Identity, GUID v7 and the Public Id Split
The most balanced way to expose an id is a bigint identity as the internal clustered key, an immutable unique PublicId outside, and an ownership condition in every query. In our measurement Guid.CreateVersion7 fragmented as badly as v4 in SQL Server (99 percent, 3,496 pages), because SQL Server sorts uniqueidentifier by its last 6 bytes; EF Core's sequential generator stayed close to identity.
Sentinel Values: The Hidden Cost of 0, -1, "1900-01-01" and 9999-12-31
Sentinel values (0 in a spending limit, 9999-12-31 in an end date, 1900-01-01 in a date) silently corrupt aggregates: in Bookstore's institutional ordering example the average limit comes out as 51,000 instead of 85,000. The fix is usually a nullable column, a separate state field when absence has several meanings and a Special Case type in the domain; a sentinel can be a deliberate standard only when a single producer owns it (temporal tables, a persisted computed column).
The Shadow Record: A Virtual Root That Doesn't Exist in the Database — "Institution = 0" Above Units
An "Institution = 0" root that doesn't exist in the database works safely if 0 is turned into an InstitutionUnitScope type (null inside) right at the API boundary; carry 0 as a plain int and you get empty lists on reads and FK violations on writes. Using Bookstore's institutional unit tree, the post compares the virtual root, a real root row, an Institution entity and an explicit scope contract with their trade-offs.
What Is a Solution Pattern? Real-World Problems Missing from GoF and the Pattern Template
A solution pattern is a recurring application decision that, unlike the code-structure patterns of GoF (the Gang of Four), cuts across data, API and UI together (soft delete, sentinel values, a virtual root). This post introduces the series' Pattern Template, its fixed trade-off criteria and the starting schema of Bookstore's institutional ordering portal.
Upgrading C# and .NET: Moving an Old Project to .NET 10
Moving a .NET 6 project to .NET 10: the support calendar, how LangVersion relates to the TFM and the latest trap, pinning the SDK with global.json, reading the real CS8981 and CS9258 warnings, the silent behavior change of the field keyword and reading breaking-change pages; C# 15 gets its own post.
What's New in C# 14: Extension Members, field and Null-Conditional Assignment
C# 14 next to its C# 10 and C# 13 equivalents: null-conditional assignment skipping the right-hand side, extension properties, static extension members and extension operators, the field keyword, arrays converting to spans, nameof(List<>), lambda parameter modifiers, partial constructors/events and compound assignment operators.
What's New in C# 13: params Collections, Lock and Partial Properties
C# 13 next to its C# 10 equivalents: the new Lock type and the CS9216 trap, params collections with an allocation measurement, ref structs implementing interfaces and allows ref struct, partial properties, OverloadResolutionPriority, the \e escape and ^ indexes in initializers.
What's New in C# 12: Primary Constructors and Collection Expressions
C# 12 next to its C# 10 equivalents: why a primary constructor is a parameter rather than a property and the CS9124 warning, square-bracket collection expressions and spread, default lambda parameters, alias any type, inline arrays, the Experimental attribute and a note on interceptors.
What's New in C# 11: Raw Strings, required and List Patterns
How we wrote it in C# 10 and how we write it in C# 11: raw string literals and the culture trap, required members and SetsRequiredMembers, list patterns, generic math with its language and library legs, file-local types and UTF-8 literals.