~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

  1. ASP.NET Core and the Pipeline — [Intermediate] — the two-phase program, middleware order as behaviour, DI lifetimes, configuration, Kestrel
  2. Minimal APIs and MVC — [Intermediate] — the two styles, which to pick, validation, ProblemDetails, and how the OpenAPI story differs from FastAPI’s
  3. Data Access — [Intermediate] — EF Core and Dapper, the three mistakes behind most slow endpoints, migrations, concurrency
  4. Testing and Production — [Intermediate] — WebApplicationFactory, Testcontainers, OpenTelemetry, Docker, and the production checklist

The things worth carrying

  1. Register before Build(), compose after. Two phases, and mixing them is the first thing to go wrong → 01
  2. Middleware order is behaviour — UseAuthorization before UseAuthentication makes every request anonymous, silently → 01
  3. A scoped service injected into middleware or a singleton is captured forever → 01
  4. Use IHttpClientFactory. A new HttpClient per request exhausts sockets; a static one misses DNS changes → 01
  5. Route constraints match; they don’t validate. {id:int} gives a 404, not a 400 → 02
  6. Minimal APIs scale fine — but you impose the structure, or you get a 900-line Program.cs → 02
  7. .ToList() in the wrong place moves the filter out of SQL and loads the table → 03
  8. Include or you have an N+1. Watch the query count, not the wall clock → 03
  9. AsNoTracking on read-only queries is free performance → 03
  10. Read generated migrations. A rename can be detected as drop-and-create → 03
  11. HasPrecision on money. Floating-point currency is a bug at the schema level → 03
  12. Test against a real database in Testcontainers, not the In-Memory provider — which passes tests that fail against real SQL → 04
  13. Liveness and readiness are different questions. A database check in liveness restarts pods over a blip → 04

How it compares

ASP.NET CoreFastAPISpring BootExpress
DIBuilt inDepends()Built inManual
ValidationDataAnnotations / FluentValidationPydantic — same model as the schemaBean ValidationManual (zod)
OpenAPIGenerated from types + attributesDerived from the validator — cannot driftAdd-onAdd-on
Concurrencyasync, thread poolASGI event loopVirtual threads (21+)Event loop
StructureYoursYoursPrescribed-ishYours

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:

  1. dotnet new webapi, one endpoint, EF Core against Postgres in Testcontainers. An afternoon, and it makes all four notes concrete
  2. Cause the N+1 deliberately, see it in the SQL log, fix it with Include, record the query counts
  3. Reverse UseAuthentication and UseAuthorization and watch every request become anonymous with no error. Note 01’s central claim, verified in a minute
  4. Write one WebApplicationFactory test — 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.

↑ Back to frameworks/ — Ways of Building a Backend