Benchmarks .NET exception handling with BenchmarkDotNet across 100,000 iterations, comparing a no-exception baseline, a try/catch path throwing InvalidOperationException, and a OneOf<T> discriminated-union return type to quantify the CLR's stack-unwinding and heap-allocation overhead. ...
Refactors a fat ASP.NET Core OrdersController that enforces a five-orders-per-day rule directly inside CreateOrder into a testable IOrderService/OrderService pair, showing how moving validation like user-activity checks and order limits out of the controller keeps it thin and SRP-compliant. ...
Builds an IMovieRepository/MovieRepository/MovieService layer around EF Core's DbContext with a GetTopRatedAsync(8.0) query, then argues the abstraction pays off only for complex domains like banking or insurance, while simple CRUD apps are often better served by DbContext directly. ...
Benchmarks IEnumerable against List, arrays, LINQ chains, and yield-based sequences in C# using BenchmarkDotNet with collection sizes of 1,000 and 100,000, showing how deferred execution and repeated enumeration can make IEnumerable up to 7x slower than a materialized List in hot paths. ...
Compares EF Core's Table-per-Hierarchy, Table-per-Type, and Table-per-Concrete-Type inheritance strategies using an abstract Employee base class with Contractor, FullTimeEmployee, and PartTimeEmployee subtypes, configuring TPH with HasDiscriminator<EmployeeTypeEnum> to store every row in one table. ...
Uses a PostgreSQL-backed EF Core project with Player, Team, and PlayerTeam entities to show how primitive obsession with plain int IDs lets a TeamId slip in where a PlayerId is expected, then wraps each ID in a strongly-typed struct so mixing them up becomes a compile-time error. ...
Builds a multi-tenant rate limiter in a .NET 10 LTS Web API using the native RateLimitPartition.GetTokenBucketLimiter, a TenantResolver that reads the X-Tenant-ID header, and per-tenant token bucket policies returning 429 Too Many Requests once a tenant's plan-based request limit is exceeded. ...
Benchmarks a CreateDeviceRequest DTO validated with DataAnnotations like Required and Range across identical .NET 8 and .NET 10 Web APIs using BenchmarkDotNet and HttpClient, showing how .NET 10's reflection-free validation metadata cuts request latency by roughly 3x on invalid payloads. ...
Compares a .NET 8 minimal API against a .NET 10 minimal API using BenchmarkDotNet, showing how static lambda route handlers eliminate closure allocations and how AllowOutOfOrderMetadataProperties speeds up JSON deserialization to cut a /weather endpoint's response time and GC pressure. ...