Benchmarks EF Core 8 against EF Core 10 by querying a PostgreSQL Users table seeded with 200,000 rows through an AsNoTracking().Where().Select() minimal API endpoint, measuring a 25-50% speed boost in production data fetching from JIT inlining and row materialization improvements. ...
Benchmarks parsing a JSON log entry's deviceId field with Newtonsoft.Json, System.Text.Json's JsonDocument, and the span-based Utf8JsonReader across .NET 8 and .NET 10 using BenchmarkDotNet, measuring 38% faster execution and lower allocations for high-volume log aggregation jobs. ...
Refactors an if-else DiscountService that hardcodes Regular (5%) and VIP (20%) discount math into an IDiscountStrategy interface with separate strategy classes, then wires the right strategy into ASP.NET Core's DI container so adding a new membership tier needs no changes to existing code. ...
Uses a PostgreSQL-backed EF Core console app with a Movie entity and a Budget owned entity holding ProductionCost, MarketingCost, and DistributionCost to show how owned types get stored as prefixed columns in the parent table without their own primary key, DbSet, or independent lifecycle. ...
Compares fetching a PostgreSQL Movie/Director schema with and without EF Core projections, showing how loading full entities with every column and navigation property triggers extra change tracking, slower deserialization, and N+1 query risk versus selecting only the fields a view actually needs. ...
Builds the same Product/Quantity/Price Excel report three ways in C# with the low-level DocumentFormat.OpenXml SDK's SpreadsheetDocument and WorkbookPart classes, then EPPlus, then ClosedXML, contrasting OpenXML's verbose cell-by-cell XML construction against the other libraries' higher-level APIs. ...
Compares DDD's Repository pattern against the Specification pattern using a Building aggregate root with nested Floor and Location child entities, showing how encapsulating query logic in reusable Specification objects scales better than adding new repository methods each time query needs grow. ...
Explains the .NET Garbage Collector's mark, relocate, and compact phases on the managed heap and its Gen 0/1/2 generational model, showing why short-lived objects like loop variables are reclaimed cheaply in Gen 0 while longer-lived objects get promoted to slower, less frequent collections. ...
Uses BenchmarkDotNet with MemoryDiagnoser to measure boxing a plain int into object, unboxing it back, and comparing both against an unboxed baseline, then extends the test to ArrayList versus List<int> to quantify how boxing's hidden heap allocations and GC pressure outweigh simple stack usage. ...