Writing
All posts
Practical C#, .NET, and ASP.NET Core tutorials.
110 posts

Respawn for Integration Tests in ASP.NET Core
Shared database state makes integration tests flaky. Respawn resets tables between tests so WebApplicationFactory and Testcontainers stay fast, isolated and reliable.

Smart Enums in ASP.NET Core
C# enums are lightweight but limited. Smart enums give you type-safe instances with FromId, FromName and List, plus clean EF Core mapping and JSON serialization.

Value Objects in .NET
Primitives hide domain meaning. Value objects model concepts like Money and Address with value equality, immutability and rules built in.

MethodTimer by Fody in .NET
Stopwatch timing clutter adds up fast. MethodTimer.Fody weaves duration logging at compile time with a [Time] attribute, optional custom loggers and parameter values in messages.

Dapper Transactions in ASP.NET Core
Dapper does not wrap writes in an implicit transaction. Learn BeginTransaction, Dapper.Transaction and TransactionScope so related SQL statements commit or roll back together.

Integration Tests in ASP.NET Core
Unit tests miss the full request pipeline. Integration tests with WebApplicationFactory, Testcontainers and Respawn verify your ASP.NET Core API against a real PostgreSQL database.

Generic Repositories in .NET
Generic repositories reuse common CRUD, but pure ones often become an anti-pattern. A hybrid base repository plus specific interfaces keeps reuse without losing entity-focused queries.

Getting Started with MongoDB in ASP.NET Core
Wire up MongoDB.Driver in ASP.NET Core with options binding, a singleton IMongoClient, BSON document mapping and full CRUD for a Product collection.
The next issue lands Thursday.
Join 4,000+ .NET engineers. Free, focused, and easy to leave.