Add file logging to an ASP.NET Core API with Serilog: configure the File sink, enable daily rolling logs, move settings to appsettings.json, control log levels, and enrich entries with machine name and user context. Includes a startup-exception logging example and production tips. ...
Five EF Core bulk-fetch methods from Z.EntityFramework.Extensions that bypass the 2,100-parameter limit of .Contains: WhereBulkContains, WhereBulkNotContains, BulkRead, WhereBulkContainsFilterList, and WhereBulkNotContainsFilterList, benchmarked on a 1M-row PostgreSQL dataset. ...
Builds an ASP.NET Core Minimal API benchmarked with BenchmarkDotNet against a PostgreSQL Orders table, comparing a naive EF Core query using Include and Take(50000) against a raw Dapper query with pagination, indexing, and connection pooling to sustain 1M requests per minute. ...
Shows how to build a file upload endpoint in a .NET 10 ASP.NET Core Web API using IFormFile and FileStream, add Swashbuckle.AspNetCore for OpenAPI/Swagger docs, cap uploads at 100 MB via MultipartBodyLengthLimit, and organize the code into clean, testable service layers with download support. ...
Walks through building a .NET console app that uses Dapper, the micro-ORM created by Stack Overflow, with Npgsql to query a PostgreSQL database of Movie and Director records, covering a DbConnectionFactory setup, JOINs, aggregate functions, stored procedures, and transactions. ...
Demonstrates advanced C# pattern matching using record types for User, Address, and Request, covering nested property patterns like user is { Address.City: "Karachi" }, negation with 'not', combined 'or' cases, LINQ filtering by shape, and relational patterns like age is > 18 and < 60. ...
Covers 12 PostgreSQL tuning techniques with EXPLAIN ANALYZE benchmarks, including adding a customer_id index that cuts a 240ms query, avoiding SELECT *, reordering JOINs so the smaller table filters first, using LIMIT, partial indexes like idx_completed_orders, and choosing efficient data types. ...
Explains why some EF Core LINQ queries fail to translate to SQL, using a Perfume model backed by PostgreSQL and Npgsql to show ToQueryString() output, how StartsWith becomes a SQL LIKE clause, and cases involving custom methods or reflection that force client-side evaluation instead. ...
Shows how to map a read-only PostgreSQL view named vw_product_summary into a ProductSummary entity in EF Core using ToView() and HasNoKey(), keeping the mapped view separate from the Product table so schema migrations don't break when the view definition changes. ...