Codepth.dev
Patterns & Solutions

C# & .NET Playbook

Real-world patterns for the problems you actually hit — each playbook shows multiple approaches with tradeoffs, so you can pick the right solution for your situation.

22 of 22 playbooks

Database

Reading Large DB Result Sets & Pagination

Your get all records query just spiked memory to 4GB

medium6 ways →
Database

Bulk Inserts & Updates

Importing 1M rows takes 5 minutes and times out

medium6 ways →
Database

The N+1 Query Problem

One list page is firing 1000 database queries

medium5 ways →
Database

Searching Across Large Datasets

LIKE '%term%' scans every row and crawls

medium5 ways →
API

Long-Running Operations

The request times out before the work finishes

medium5 ways →
API

Rate Limiting & Throttling

One client is hammering your API into the ground

medium5 ways →
API

Idempotency & Duplicate Requests

The user double-clicked and got charged twice

medium5 ways →
Architecture

Inter-Service Communication

One slow service is taking down everything upstream

medium5 ways →
Performance

Caching & Cache Invalidation

The same expensive query runs ten thousand times a minute

medium6 ways →
Performance

Background & Scheduled Jobs

Your nightly job runs five times on five servers

medium5 ways →
Reliability

Resilience & Retrying Failed Operations

A 50ms network blip just failed a user's request

advanced5 ways →
Performance

Concurrency & Parallel Processing

Processing 10000 items one at a time takes forever

advanced5 ways →
Reliability

Distributed Transactions & Data Consistency

Payment succeeded but the order never shipped

advanced5 ways →
Architecture

File & Blob Handling at Scale

A few big uploads just exhausted your server memory

medium5 ways →
API

Real-Time Data Push to Clients

Clients poll every 3 seconds just to feel live

medium5 ways →
Cross-Cutting

Mapping & Transforming Data (Entity to DTO)

You accidentally serialized a password hash to the API

easy5 ways →
Cross-Cutting

Validating Input

Bad data reached your database and corrupted state

easy5 ways →
Cross-Cutting

Configuration & Secrets Management

A database password just got committed to Git

medium5 ways →
Cross-Cutting

Time Zones & Dates Across Systems

The meeting shows at the wrong hour for half your users

medium5 ways →
Database

Soft Deletes & Audit Trails

Who deleted this, and can we get it back?

medium5 ways →
Architecture

Multi-Tenancy Data Isolation

One customer just saw another customer's data

advanced5 ways →
API

Handling Large Data Payloads in Your API

A 2GB upload just spiked your server's memory to 2GB

advanced5 ways →