Pagination in EF Core, Continued: Sortable Grids, htmx, and the Indexing Cost
The first post in this series made a clean case for keyset pagination over Skip/Take. Readers on LinkedIn pushed back with a fair question I’d dodged: what about sortable grids where the user picks the column? The post showed ORDER BY Id, which is the easy case. Real apps have grids with eight clickable column headers and a “sort direction” …
Continue Reading
Pagination in Entity Framework Core: Why Skip/Take Falls Apart on Hot Tables
If you’ve built an ASP.NET Core API or list view backed by Entity Framework Core, you’ve almost certainly written something like this: It works. It matches the page-number UI most users expect. Every EF Core tutorial uses it. It’s also the wrong default once your table grows beyond a few hundred thousand rows or begins seeing concurrent writes. This post …
Continue Reading
How to Delete and Update Millions of Rows in EF Core Without Loading a Single Entity
This post is sponsored by ZZZ Projects. The Code Every Developer Has Written and Regretted Most EF Core performance disasters are not exotic edge cases. They get written in the first sprint, look clean in code review, and only reveal themselves when row counts hit production scale. The pattern below has ended more than a few on-call rotations badly: On …
Continue Reading
Debugging Entity Framework Core: 8 Real-World Query Anti‑Patterns (and How to Fix Them)
This is my post for the 2025 C# Advent. Check out all the great posts! I want to wish you a Merry Christmas, Happy Holidays, Happy Hanukkah, Happy Kwanzaa, and, finally, Happy Festivus. I will not be sharing my “Airing of grievances” or challenge anyone to a “Feats of strength.” Entity Framework Core is an excellent library for CRUD operations against …
Continue Reading
Temporal Tables in EF Core: Bringing Time Travel to Your Data
What if you could go back in time and see exactly what your database looked like yesterday, last week, or even last year? Sounds like something out of a sci-fi movie, right?
Well, Temporal Tables in SQL Server let you do exactly that!
Continue Reading
JSON Columns in SQL Server: Storing & Querying JSON with EF Core
Ever wished you could store semi-structured data in your database without dealing with complex table relationships? Good news! SQL Server has native JSON support, and EF Core makes working with JSON columns easier than ever.
Whether you’re handling dynamic configurations, logging data, or flexible user preferences, JSON columns let you mix structured and unstructured data in SQL Server—without creating dozens of extra tables.
Continue Reading
Keyless Entity Types in EF Core: Query Data Without Primary Keys
Not everything in your database needs a primary key. Sometimes, you just want to query views, stored procedures, or raw SQL results without forcing a unique identifier on them. That’s where Keyless Entity Types in EF Core come in!
If you’ve ever struggled with querying database views, reports, or read-only datasets, this feature is exactly what you need. Let’s dive into what Keyless Entity Types are, when to use them, and how to make them work in EF Core.
Continue Reading
Grouping Smarter: LINQ GroupBy Enhancements in EF Core
Grouping data in Entity Framework Core (EF Core) used to feel a little… clunky. Sometimes, LINQ’s GroupBy() worked beautifully in-memory but got lost in translation when executing SQL queries. You’d write a simple GroupBy(), and EF Core would pull all the data into memory before doing the grouping—not good!
But things are getting smarter and more efficient in recent versions of EF Core! With LINQ GroupBy enhancements, EF Core now translates more grouping operations into optimized SQL queries, saving memory and improving performance.
Continue Reading
Transactional Savepoints in EF Core: Rollback Just What You Need!
We’ve all been there—you’re halfway through a multi-step transaction, and boom! 💥 Something fails. You don’t want to roll back everything, just the part that went wrong.
That’s where Transactional Savepoints come in!
Savepoints let you partially roll back transactions, keeping the good stuff while undoing just the problematic parts. If you’ve ever wished for a “Ctrl + Z” in database operations, this is it.
Continue Reading
Tapping into Database Views with EF Core: Reverse Engineering Made Easy
Not all database tables are created equal! Sometimes, you don’t need direct access to raw data—you need a refined, read-only version that makes querying easier. That’s where database views come in!
Continue Reading