~2,900 words across 4 notes. Built August 2026. [reference].
Flat notes by concern, per the folder test: C# has one dominant framework. Minimal APIs and MVC are two styles within ASP.NET Core, not competing frameworks — so a note about one applies to the other, and the material is really about the language’s approach.
The one idea: ASP.NET Core is batteries-included but unopinionated about structure. DI, configuration, logging, health checks, rate limiting and OpenAPI are in the box; layering, boundaries and where your business logic lives are entirely yours → structuring a backend.
Reading order
- ASP.NET Core and the Pipeline — [Intermediate] — the two-phase program, middleware order as behaviour, DI lifetimes, configuration, Kestrel
- Minimal APIs and MVC — [Intermediate] — the two styles, which to pick, validation,
ProblemDetails, and how the OpenAPI story differs from FastAPI’s - Data Access — [Intermediate] — EF Core and Dapper, the three mistakes behind most slow endpoints, migrations, concurrency
- Testing and Production — [Intermediate] —
WebApplicationFactory, Testcontainers, OpenTelemetry, Docker, and the production checklist
The things worth carrying
- Register before
Build(), compose after. Two phases, and mixing them is the first thing to go wrong → 01 - Middleware order is behaviour —
UseAuthorizationbeforeUseAuthenticationmakes every request anonymous, silently → 01 - A scoped service injected into middleware or a singleton is captured forever → 01
- Use
IHttpClientFactory. A newHttpClientper request exhausts sockets; a static one misses DNS changes → 01 - Route constraints match; they don’t validate.
{id:int}gives a 404, not a 400 → 02 - Minimal APIs scale fine — but you impose the structure, or you get a 900-line
Program.cs→ 02 .ToList()in the wrong place moves the filter out of SQL and loads the table → 03Includeor you have an N+1. Watch the query count, not the wall clock → 03AsNoTrackingon read-only queries is free performance → 03- Read generated migrations. A rename can be detected as drop-and-create → 03
HasPrecisionon money. Floating-point currency is a bug at the schema level → 03- Test against a real database in Testcontainers, not the In-Memory provider — which passes tests that fail against real SQL → 04
- Liveness and readiness are different questions. A database check in liveness restarts pods over a blip → 04
How it compares
| ASP.NET Core | FastAPI | Spring Boot | Express | |
|---|---|---|---|---|
| DI | Built in | Depends() | Built in | Manual |
| Validation | DataAnnotations / FluentValidation | Pydantic — same model as the schema | Bean Validation | Manual (zod) |
| OpenAPI | Generated from types + attributes | Derived from the validator — cannot drift | Add-on | Add-on |
| Concurrency | async, thread pool | ASGI event loop | Virtual threads (21+) | Event loop |
| Structure | Yours | Yours | Prescribed-ish | Yours |
The comparison worth internalising is the OpenAPI row. FastAPI derives the schema from the same Pydantic model that validates, so documentation and behaviour cannot diverge. ASP.NET Core generates the schema from types and attributes while validation may live in a separate FluentValidation class — so drift is possible, and it’s a genuine structural difference rather than a maturity gap.
The honest note
[reference] — no ASP.NET Core in this vault’s projects/; the backend work here is Node/Nest and Java/Spring.
What would close the gap:
dotnet new webapi, one endpoint, EF Core against Postgres in Testcontainers. An afternoon, and it makes all four notes concrete- Cause the N+1 deliberately, see it in the SQL log, fix it with
Include, record the query counts - Reverse
UseAuthenticationandUseAuthorizationand watch every request become anonymous with no error. Note 01’s central claim, verified in a minute - Write one
WebApplicationFactorytest — it’s the feature most worth stealing conceptually even if you work in another stack
What’s missing: authentication and authorization in depth (JWT, cookies, policies, Identity), SignalR and WebSockets, background services and hosted workers, Blazor, gRPC, output caching, and YARP.
Related
- the C# course — the language, per the rule
- frameworks/ · the backend course
Software engineering
Infrastructure & security
Computer science
Hardware & engineering