Skip to main content

November 2026

Every post published in November 2026, newest first. Pick a day to jump straight to it.

Posts
1,091
Topics
89
Reading time
124 h
Active days
16

Posts 901–930 of 1,091 · November 4, 2026

Page 31 of 37

Wednesday, November 4, 2026

30 of 91 posts

  1. TypedResults vs Results in ASP.NET Core Minimal APIs

    Results and TypedResults send the same HTTP response, but only one tells the OpenAPI document what your endpoint returns. Two versions of the same .NET 10 endpoint, the documents they generate side by side, and the return type that makes TypedResults work.

  2. How to Return 201 Created with a Location Header from a Minimal API

    Answer a successful POST the way HTTP intends: 201 Created, a Location header that points at the new resource, and the resource in the body. Both TypedResults.Created with a path and CreatedAtRoute with a named route, with the real responses from .NET 10.

  3. How to Move Minimal API Endpoints into Their Own Class

    Keep Program.cs short: move ASP.NET Core minimal API endpoints into a static class with an extension method on IEndpointRouteBuilder, one folder per feature, with handlers as private methods. The complete pattern from a real .NET 10 C# API.

  4. How to Group Minimal API Endpoints with MapGroup

    Stop repeating /api/v1/categories on every route. MapGroup gives a set of ASP.NET Core minimal API endpoints a shared prefix, shared settings such as WithTags, and groups inside groups. Built on a real .NET 10 API, with the routes it produces.

  5. How to Cancel EF Core Queries with a CancellationToken in a Minimal API

    Pass the request's CancellationToken to EF Core in a minimal API, and see what it really does on MySQL: with Oracle's connector, the token stopped the next query, but a query already running kept going until it finished. Measured with SLEEP and MySQL's process list.

  6. Why Each Request Gets Its Own DbContext in ASP.NET Core

    AddDbContext registers a scoped service, so each HTTP request gets its own DbContext, and everything in that request shares it. Proved with real ContextId values, then what the rule means for background tasks, singletons and startup code.

  7. How to Return 409 Conflict for a Duplicate Key with EF Core and MySQL

    Turn MySQL's duplicate entry error into a clear 409 Conflict in a .NET C# Web API: a small extension method reads the error number from DbUpdateException, and catch with when handles only that error. The same pattern works for foreign key errors, with real before and after output.

  8. How to Use a Concurrency Token in EF Core with MySQL

    Stop two people silently overwriting each other's changes: add an int Version column, mark it with IsConcurrencyToken, compare the version the client read, and answer 409 on a conflict. Before and after, with the real SQL from EF Core 10 and MySQL 9.7.

  9. How to Sort EF Core Results from a Query String Safely

    Let API clients choose a sort order without letting them touch your SQL: an allow-list with AllowedValues, a switch that maps each value to OrderBy, and ThenBy on the key so pages stay stable. Real requests and SQL from a .NET 10 API on MySQL.

  10. How to Add Optional Filters to an EF Core Query

    Build an EF Core query in pieces, adding a Where only when a filter is given. Because IQueryable doesn't run until the end, each request gets exactly the SQL it needs. Real SQL from MySQL for no filter, one filter and a search.

  11. How to Search Text with EF Core on MySQL: Contains, StartsWith and LIKE

    Compare EF Core's text searches on MySQL with Oracle's provider: Contains becomes LOCATE and ignores case, StartsWith and EndsWith add COLLATE utf8mb4_bin and don't, and EF.Functions.Like follows the column and treats % as a wildcard. Real SQL and results for each.

  12. How to Add Paging to an EF Core Query with Skip and Take

    Page through rows with EF Core's Skip and Take, sorted so rows can't move between pages, with a total count and a page size limit. See the LIMIT and OFFSET it sends to MySQL 9.7, and a paged response record for a .NET C# Web API.

  13. How to Delete Rows Without Loading Them with ExecuteDeleteAsync in EF Core

    Delete one row or many with one DELETE statement, using EF Core's ExecuteDeleteAsync. Read the row count for a clean 404, and handle the difference that catches people: a foreign key failure is a plain MySqlException here, not a DbUpdateException. Real output from MySQL 9.7.

  14. How to Update Rows Without Loading Them with ExecuteUpdateAsync in EF Core

    Change one row or thousands with one UPDATE statement, using EF Core's ExecuteUpdateAsync: set constants, set values based on the current ones, and read the row count. Plus the two traps, stale tracked objects and concurrency tokens, shown with real output from MySQL 9.7.

  15. How to Delete a Row with EF Core and SaveChangesAsync

    Delete a row with EF Core 10: load it, call Remove, then SaveChangesAsync. The real SQL from MySQL, a 204 or 404 answer for a Web API, and a clean 409 when other rows still point at it through a foreign key.

  16. How to Update a Row with EF Core and SaveChangesAsync

    Update a row with EF Core 10: load it, change a property, and call SaveChangesAsync. The real SQL shows only the changed column is written, and no UPDATE at all when nothing changed. Compared with calling Update on a new object, which writes every column.

  17. EF Core Entity States Explained: Detached, Added, Unchanged, Modified and Deleted

    Follow one EF Core entity through every state, from Detached to Added, Unchanged, Modified, Deleted and back to Detached, with the state printed at each step and the SQL each save sends. Real output from EF Core 10 and MySQL 9.7.

  18. How to See What EF Core Will Save with ChangeTracker.DebugView

    ChangeTracker.DebugView shows every entity EF Core is tracking, its state, and which properties changed, before you call SaveChangesAsync. Read its LongView output, line by line, from a real change on EF Core 10 with MySQL.

  19. How to See the SQL of a LINQ Query with ToQueryString in EF Core

    ToQueryString shows the SQL EF Core would send for a LINQ query, without running it. Use it for one query instead of turning on logging for the whole app, and see how constants and parameters appear, on EF Core 10 with MySQL 9.7.

  20. How to Check If a Row Exists with AnyAsync in EF Core

    Check whether a row exists with EF Core's AnyAsync: it sends SELECT EXISTS to MySQL and returns true or false, without loading the row or counting the rest. When to use it, and why it can't replace a unique index for duplicates.

  21. How to Count Rows with CountAsync in EF Core

    Count rows with EF Core's CountAsync: all rows, rows that match a condition, and a filtered query you've built up in pieces, with the SELECT COUNT(*) each one sends to MySQL. And why calling .Count on a list loads every row instead.

  22. How to Load Related Data in EF Core: Include vs Select

    Three ways to read a product's category with EF Core, with the SQL for each from MySQL: no Include gives null, Include joins and loads every column, and Select joins for just what you ask. Plus collections with LEFT JOIN and counting related rows with a subquery.

  23. How to Use AsNoTracking in EF Core

    What AsNoTracking changes in EF Core, measured: the SQL stays the same, the change tracker stays empty, and reading 5,000 rows took less time in five runs out of five. When you need it, when you don't, and why projections never need it. EF Core 10 with MySQL 9.7.

  24. How to Reuse a Select Projection with an Expression in EF Core

    Keep one definition of an EF Core projection and use it in every query, with Expression<Func<T, TResult>>. Why a normal C# method in Select loads the whole row and crashes with NullReferenceException on a navigation, and how the same code as an expression sends just the columns and the join.

  25. How to Select Only the Columns You Need with EF Core

    Use Select in EF Core to read only the columns you need from MySQL. Compare the SQL for a whole entity with thirteen columns and a projection with two, map results to a record, and see that projected results aren't tracked. Real logs from EF Core 10 and MySQL 9.7.

  26. FirstOrDefaultAsync vs SingleOrDefaultAsync vs FindAsync in EF Core

    Three ways to read one row with EF Core, compared on real SQL from MySQL: FirstOrDefaultAsync sends LIMIT 1, SingleOrDefaultAsync sends LIMIT 2 and throws on a second row, and FindAsync checks the change tracker first and sends nothing the second time. Which to use, with evidence.

  27. How to Read Rows from MySQL with EF Core and LINQ

    Read rows from MySQL with EF Core 10: write a LINQ query with Where and OrderBy, run it with ToListAsync, and read the SQL it becomes. Includes the proof that nothing reaches MySQL until the last line, and why filtering after ToListAsync reads the whole table.

  28. How to Add Several Rows at Once with EF Core AddRange

    Insert several rows in one SaveChangesAsync call with EF Core's AddRange, and see what reaches MySQL: three INSERT statements in one command, 50 rows split into batches of 42 and 8, and each object getting its own ID. Real output from EF Core 10 with Oracle's MySQL provider.

  29. How to Insert a Row with EF Core and Get the Generated ID in MySQL

    Insert a row with EF Core 10 and read the ID MySQL gave it. See the INSERT that Add and SaveChangesAsync send, why ROW_COUNT and LAST_INSERT_ID follow it, how the object's Id changes, and what happens when you set an ID yourself. Real SQL from Oracle's provider and MySQL 9.7.

  30. How to Add Scalar API Documentation to a .NET 10 C# Web API

    Add an interactive API documentation page to a .NET 10 C# Web API with Scalar.AspNetCore and the OpenAPI document ASP.NET Core already generates. Install the package, map it for Development only, open /scalar/v1, and see your endpoints with their summaries.