From a Flat List to a Tree in One Line of C#
Series · Hierarchical dataA quick look at turning a flat collection with parent references into a navigable hierarchy, without writing recursion yourself.
Patterns, gotchas and small wins from fifteen-odd years of .NET and web work — the Regira packages and modules, entity pipelines, editorial front-ends and everything between.
A quick look at turning a flat collection with parent references into a navigable hierarchy, without writing recursion yourself.
Answer who reported to whom on any past date from the data you already store, with no history tables and no migrations. One dated relationship table and a single filter do it; Westeros supplies three centuries of test data.
A small tool that copies files between local disks, network shares and cloud storage, where a new copy job is a config entry, not new code. Built on one storage abstraction, so adding a backend is one small class.
One table for every customer, supplier and employee, with roles and alliances as dated relationships instead of extra tables. Tested on Westeros, where everyone knows who betrayed whom and when.
Keep file storage behind one interface and let each environment choose disk, network share or Azure in configuration. Tests run without cloud credentials, and moving your files later is a copy job, not a rewrite. Uploads are typed by the server, so none can pose as a page of your site.