Top 3 Ef core Interview Questions
Browse 3 real-world technical and behavioral interview questions about Ef core. Review scenarios, edge cases, and architectural best practices.
A read-only endpoint that returns fifty thousand rows is slow and memory-heavy in EF Core. What is the context doing?
The context snapshots every entity it loads so it can work out what changed at save time, which is useful for a handful of entities and pure overhead for a read. AsNoTracking removes the snapshot, and the same mechanism explains why a stray mutation on a tracked entity gets written even though you never called Update.
Two users edit the same record and both save. What does EF Core do about it?
EF Core optimistic concurrency uses a rowversion or concurrency token so a stale update affects zero rows instead of overwriting another user's change. The application must then merge, retry or ask the user.
This EF Core query is slow. How do you work out why, and what does change tracking have to do with it?
EF Core query performance starts with the generated SQL, then checks N+1 queries, cartesian Include joins, over-fetching and change tracking. Use projections and AsNoTracking when the result is read-only.