Mert Özen Further With Every Line

Blog

Mert Özen's blog posts on software development, backend, frontend, and DevOps.

Series
28 posts found
What Is Entity Framework Core? The ORM Idea and EF Core's Architecture
Database PART 01

What Is Entity Framework Core? The ORM Idea and EF Core's Architecture

Starting from plain ADO.NET code we see why ORMs exist: EF Core's DbContext, model, provider and change tracker, the different SQL SQLite and SQL Server generate from the same LINQ, EF6 versus EF Core, a Dapper comparison and how the series is organized.

5 Nov 2026 9 min 2
Your First EF Core App: DbContext, DbSet, SQLite and the Generated SQL
Database PART 02

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.

5 Nov 2026 10 min 2
Model and Conventions in EF Core: Keys, Nullability, Column Types and Shadow Properties
Database PART 03

Model and Conventions in EF Core: Keys, Nullability, Column Types and Shadow Properties

We read how EF Core builds its model from real schema output: the key convention, NOT NULL and NULL columns with NRT, SQLite and SQL Server column types, the decimal warning, temporary keys and Guid generation, where table names come from, and the shadow foreign key EF Core adds on its own.

5 Nov 2026 9 min 2
Data Annotations or Fluent API in EF Core? OnModelCreating and IEntityTypeConfiguration
Database PART 04

Data Annotations or Fluent API in EF Core? OnModelCreating and IEntityTypeConfiguration

We put the two ways of overriding conventions side by side: data annotations and the Fluent API in OnModelCreating. We split configuration with IEntityTypeConfiguration and ApplyConfigurationsFromAssembly, test unique indexes, check constraints and default values against real SQLite errors, and see the precedence order and the bool default trap.

5 Nov 2026 9 min 3
Relationships in EF Core, Part 1: One-to-Many, Foreign Keys and Cascade Delete
Database PART 05

Relationships in EF Core, Part 1: One-to-Many, Foreign Keys and Cascade Delete

We build a one-to-many relationship with Author and Book: principal, dependent and foreign key, how the convention finds the relationship, HasOne/WithMany in the Fluent API, adding graphs and fixup, required versus optional relationships, and real SQLite output for Cascade, ClientSetNull and Restrict with loaded and unloaded dependents.

5 Nov 2026 10 min 3
Relationships in EF Core, Part 2: One-to-One, Many-to-Many and UsingEntity
Database PART 06

Relationships in EF Core, Part 2: One-to-One, Many-to-Many and UsingEntity

We build one-to-one with Author and AuthorProfile and many-to-many with Book and Tag: the unique foreign key index, the dependent-side error and HasForeignKey<T>, skip navigations and the BookTag table created by convention, naming the join table with UsingEntity and a join entity with a TaggedAt payload.

5 Nov 2026 10 min 2
EF Core Migrations: migrations add, database update, Scripts and Bundles
Database PART 07

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.

5 Nov 2026 10 min 2
Seeding in EF Core: Model Seeding with HasData and Application-Side Seeding
Database PART 08

Seeding in EF Core: Model Seeding with HasData and Application-Side Seeding

Two ways to add initial data in EF Core: model seeding with HasData and the InsertData/UpdateData/DeleteData it generates, the key and navigation rules, the dynamic value trap; then a rerunnable application-side seeder and a pointer to EF Core 9's UseSeeding.

5 Nov 2026 12 min 2
LINQ Queries with EF Core: SQL Translation, Client Evaluation and the IQueryable Trap
Database PART 09

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.

5 Nov 2026 12 min 2
Loading Related Data in EF Core: Include, Explicit and Lazy Loading, Split Queries
Database PART 10

Loading Related Data in EF Core: Include, Explicit and Lazy Loading, Split Queries

We compare the three ways to load related data in EF Core with real SQL output: Include/ThenInclude and filtered include, explicit loading with the Entry API, lazy loading with proxies and its N+1 bill; then cartesian explosion and AsSplitQuery.

5 Nov 2026 12 min 3
Change Tracking in EF Core: Entity States, AsNoTracking and Identity Resolution
Database PART 11

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.

5 Nov 2026 10 min 5
Saving Data with EF Core: SaveChanges, Related Graphs and Disconnected Entities
Database PART 12

Saving Data with EF Core: SaveChanges, Related Graphs and Disconnected Entities

The two worlds of saving data in EF Core: Add/Remove and SaveChanges writing only changed columns in the connected scenario, batching on SQLite and SQL Server, saving related graphs and orphans; Update writing every column, load-and-change, SetValues, Attach and IsModified in the disconnected scenario.

5 Nov 2026 11 min 2
Blog Map