What is the difference between First, Single, Find and FirstOrDefault in EF Core?

Entity Framework & EF Core Querying Intermediate 1–2 Yrs2–3 Yrs Conceptual 1 min read

Quick Answer

Find(id) looks in the context's local tracked entities first and only queries the database if it's not already loaded — and it only works with the primary key. First/Single/FirstOrDefault always hit the database, take any predicate, and let you compose Include/Where/OrderBy.

Find is special — it checks whether that entity is already tracked in the context and returns it without touching the database, and only queries if it's not there. But it only works by primary key and you can't add an Include. First, Single and FirstOrDefault always go to the database, accept any predicate, and can be composed with Include and Where. Single also emits an extra check for a second row, so First is a bit cheaper if you don't need that guarantee.

  • Find — PK lookup, checks the identity map, no Include. Great for “get by id” when the entity might already be tracked.
  • SingleOrDefault(x => x.Id == id) — always a DB round trip (SELECT with a check for a second row).
  • FirstOrDefault(x => x.Id == id) — DB round trip, TOP 1, cheaper than Single.
  • Use the async versions (FindAsync, FirstOrDefaultAsync) in web apps.