Blog
Mert Özen's blog posts on software development, backend, frontend, and DevOps.
The Security Lab: A Bookstore API with ASP.NET Core 10 and Reading HTTP with curl
We set up the lab for the rest of the series: an ASP.NET Core 10 minimal API on SQLite. With curl -i we read methods, status codes, headers and cookies through a security lens, see how the same error reaches the client differently in Development and Production, and cover the HTTPS development certificate and the lab rules.
Type Handlers and Custom Mapping in Dapper: Guid, DateTimeOffset and CustomPropertyTypeMap
Why does Dapper blow up when reading Guid, DateTimeOffset and TimeSpan on SQLite? We write interpreters with SqlMapper.TypeHandler<T>, see from the source why SetValue is never called, and cover the DateOnly/TimeOnly story of 2.1.86 and column mapping with CustomPropertyTypeMap.
Transactions with Dapper: BeginTransaction, Commit, Rollback and TransactionScope
Starting from a half-written order, we set up BeginTransaction, the transaction: parameter, commit and rollback-on-dispose in Dapper, and see with real output why forgetting the parameter stays silent on SQLite, how isolation levels behave, and the async and SQLite traps of TransactionScope.
INSERT, UPDATE, DELETE with Dapper Execute: Affected Rows and the New Id
We run INSERT, UPDATE and DELETE with Execute and read the affected row count, get the new id with RETURNING and last_insert_rowid(), look at SQL Server OUTPUT and PostgreSQL RETURNING, and measure why Execute with a list is not bulk.
What Is Dapper? The Thin Layer on Top of ADO.NET and Your First Query
We meet Dapper as a set of extension methods on top of ADO.NET: what micro-ORM means, when to pick it over EF Core, setting up .NET 10 + Dapper 2.1.89 + SQLite, the first Query and a short history from 1.x to Dapper.AOT.
Testing with EF Core: SQLite In-Memory and InMemory Provider Pitfalls
With real test output we see how the InMemory provider silently lets unique indexes, foreign keys and raw SQL slip through, and build realistic tests with SQLite in-memory. We cover the false green of asserting on the same context and the debate about abstracting DbContext, using the EF documentation's guidance.
EF Core Migrations: migrations add, database update, Scripts and Bundles
We run EF Core migrations end to end: migrations add/remove, database update and reverting, the anatomy of a migration file, SQL scripts and --idempotent, EF Core 6 migration bundles, and the risks of calling Migrate() at startup.
Your First EF Core App: DbContext, DbSet, SQLite and the Generated SQL
We build the first EF Core app from an empty console project: the SQLite and Design packages, dotnet-ef as a local tool, DbContext and DbSet, OnConfiguring, EnsureCreated, the first insert and query, real SQL via LogTo and ToQueryString, and the SQL differences between EF Core 6 and 10.
EF Core and SQLite in ASP.NET Core Web API: DbContext, the First Migration and CRUD
We add a data layer to an ASP.NET Core Web API with EF Core and SQLite: EF Core 6 and 10 package versions, AppDbContext, the connection string, why DbContext is scoped, the first migration, async CRUD and the SQL in the console.