Blog
Mert Özen's blog posts on software development, backend, frontend, and DevOps.
Dapper Performance: Query Cache, GetRowParser and Bulk Alternatives with SqlBulkCopy and COPY
What Dapper's query cache holds and why it draws a saw blade, when CommandFlags.NoCache is needed, choosing a type per row with GetRowParser, and for the bulk operations Dapper lacks: a transaction on SQLite, SqlBulkCopy on SQL Server and COPY on PostgreSQL, all with real measurements, closing with BenchmarkDotNet.
Dapper and SQL Server: TVPs, ANSI Strings, {=literal} and Parameter Sniffing
Queries that return the right result but scan the whole index: the implicit conversion nvarchar parameters cause on varchar columns, Dapper's 4000-character rule, IN lists multiplying plans, table-valued parameters, filtered indexes with {=literal} and parameter sniffing, all with real logical-reads measurements.
Buffered and Unbuffered Reads in Dapper: Streaming Large Result Sets
We measure the difference between buffered and unbuffered reads in Dapper: an unbuffered result re-running the query on every enumeration, 191 MB versus near-zero memory on a million rows, IAsyncEnumerable streaming with QueryUnbufferedAsync, cancellation with WithCancellation and the disposed-connection trap, all with real output.
EF Core Performance Basics: N+1, Projection, AsNoTracking and Compiled Queries
We catch N+1 queries by counting commands, switch to DTO projections, measure the effect of tracking, indexes, split queries and compiled queries on SQLite, and monitor queries with TagWith and LogTo.
Change Tracking in EF Core: Entity States, AsNoTracking and Identity Resolution
We open up EF Core's change tracker: the five entity states, ChangeTracker.Entries and DebugView, the one-object-per-row rule (identity resolution), AsNoTracking vs AsNoTrackingWithIdentityResolution, when DetectChanges runs, and the 'already being tracked' error.
LINQ Queries with EF Core: SQL Translation, Client Evaluation and the IQueryable Trap
We follow how an EF Core LINQ query becomes SQL: deferred execution, ToQueryString and LogTo, filtering, sorting and paging, projection, First/Single/Find, client evaluation allowed in the final Select, and the IEnumerable trap that silently pulls the whole table.