Blog Archive
Every post on Dewiride Developer Blogs, newest first. Pick a year or a month to narrow it down, or page through them all.
- Posts
- 1,085
- Topics
- 132
- Reading time
- 130 h
- First post
- Jun 2025
Posts 631–660 of 1,085 · November 4, 2026
Page 22 of 37
November 2026
802 postsWednesday, November 4, 2026
30 of 91 posts
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.
4 min readHow 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.
4 min readHow 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.
6 min readHow 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.
6 min readHow 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.
5 min readHow 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.
5 min readFirstOrDefaultAsync 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.
5 min readHow 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.
6 min readHow 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.
5 min readHow 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.
6 min readHow 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.
5 min readHow to Send API Requests from a .http File in VS Code and Visual Studio
Keep your API requests in a .http file next to the code, and send them with a click: the REST Client extension in VS Code, or the built-in editor in Visual Studio. The file format, variables, request separators, JSON bodies and what the response looks like, with a real .NET 10 Web API.
6 min readHow to Make a MySQL Text Comparison Case-Sensitive
By default MySQL treats usb and USB as equal, and cafe and café too. Use COLLATE to compare exactly for one query, learn what utf8mb4_bin and utf8mb4_0900_as_cs do, and see the column's collation that causes it. Every statement run on MySQL 9.7.
5 min readHow to Search Text in MySQL with LIKE and LOCATE
Search for text in MySQL with LIKE and its % and _ wildcards, or with LOCATE, which has none. Find text anywhere or at the start, search for a real percent sign, and see why a lowercase search finds uppercase text. Every statement run on MySQL 9.7.
5 min readHow to Get the Last Inserted ID and Affected Rows in MySQL
LAST_INSERT_ID gives you the ID MySQL just generated, and ROW_COUNT tells you how many rows the last statement changed. See how each one behaves on MySQL 9.7 after an insert, a failed insert, an update that changes nothing, and a delete that finds nothing.
5 min readWhy MySQL AUTO_INCREMENT IDs Have Gaps
Failed inserts and rolled-back transactions use up AUTO_INCREMENT values, so IDs in MySQL skip numbers. See it happen on MySQL 9.7 with a duplicate key and a ROLLBACK, what Oracle's manual says about it, and why it's nothing to fix.
5 min readHow to Check if a MySQL Query Uses an Index with EXPLAIN
Put EXPLAIN in front of a query to see how MySQL will run it. Read the tree format MySQL 9.7 uses by default: table scans, index lookups and covering indexes, on real queries with about 5,000 rows, plus the traditional format and why LIKE '%x%' can't use an index properly.
6 min readHow to Join Two Tables in MySQL
Read from two MySQL tables at once with INNER JOIN and LEFT JOIN: what each one leaves out, how to find rows with no match, and why COUNT(*) gives the wrong number on a LEFT JOIN. Real results on MySQL 9.7, with a table of categories and a table of products.
5 min readHow to Count Rows in a MySQL Table
Count rows in MySQL with COUNT(*), count only the rows that match, count per group with GROUP BY, and get totals with SUM, MIN and MAX. Includes the difference between COUNT(*) and COUNT(column), shown with a real NULL column on MySQL 9.7.
4 min readHow to Page Results in MySQL with LIMIT and OFFSET
Page through MySQL results with LIMIT and OFFSET: the formula for any page, why ORDER BY needs a unique last column, and a real example of the same LIMIT returning different rows because no order was asked for. Run on MySQL 9.7.
5 min readHow to Delete Rows from a MySQL Table Safely
Delete rows from MySQL without losing the wrong ones: check them with a SELECT first, use ROW_COUNT, try it in a transaction you can roll back, and let foreign keys and safe-updates mode stop mistakes. Every step run on MySQL 9.7.
4 min readHow to Update Rows in a MySQL Table Safely
Change rows with UPDATE without changing the wrong ones: check the WHERE with a SELECT first, read Rows matched and Changed, use a transaction you can undo with ROLLBACK, and turn on safe-updates mode. Every step run on MySQL 9.7.
5 min readHow to Insert a Row into a MySQL Table
Add rows to MySQL with INSERT: name the columns, give the values, get the generated ID back with LAST_INSERT_ID, and add several rows in one statement. Every step run on MySQL 9.7, including the error you get for leaving a required column out.
5 min readHow to Read Rows from a MySQL Table with SELECT
Read data from MySQL with SELECT: every column or only the ones you need, one row by its ID, rows that match a condition, sorted results and the first few rows. Every statement run on MySQL 9.7, with its real output.
4 min readFixed: "Body was inferred but the method does not allow inferred body parameters" in a Minimal API
One GET endpoint with a record parameter made every request in a minimal API answer 500: InvalidOperationException: Body was inferred but the method does not allow inferred body parameters. GET requests don't get a JSON body. How [AsParameters] or a POST fixes it, and why one bad endpoint breaks them all.
6 min readFixed: "Cannot resolve scoped service 'InventoryDbContext' from root provider" in ASP.NET Core
Asking app.Services for a DbContext in Program.cs crashed the app at startup with InvalidOperationException: Cannot resolve scoped service from root provider. There's no request yet, so there's no scope. How CreateAsyncScope gives you one for startup work.
5 min readFixed: "Cannot consume scoped service 'DbContextOptions' from singleton" in ASP.NET Core
An ASP.NET Core API wouldn't start: Cannot consume scoped service DbContextOptions<InventoryDbContext> from singleton CategoryCache. A singleton lives for the whole app, and a DbContext for one request. Why Development catches this at startup, and how IServiceScopeFactory fixes it.
6 min readFixed: A Missing Number in a JSON Request Becomes 0 in an ASP.NET Core Minimal API
A request with no unitPrice was accepted, and the price quietly became 0, because a C# decimal can't be null and [Required] can't see a difference. Making the property decimal? with [Required] turns it into a clear 400. Shown on .NET 10 with AddValidation.
5 min readFixed: "415 Unsupported Media Type" from a POST to an ASP.NET Core Minimal API
A POST with valid JSON answered 415 Unsupported Media Type, and the log showed no error, because curl sends application/x-www-form-urlencoded unless told otherwise. How the debug log reveals it, and the one header that fixes it in curl, .http files and PowerShell.
5 min readFixed: "error CA1848: For improved performance, use the LoggerMessage delegates" in .NET
A plain logger.LogInformation call stopped a .NET 10 build with CA1848, and CA1873 when an argument looks expensive, because the solution treats warnings as errors with latest-recommended analysis. The LoggerMessage source generator fixes both, in a few lines.
5 min read