C# Interview

EF Core, Data Access & Performance

C# interview questions covering ef core, data access & performance.

10 Questions Filter by level

Interview questions

Open a question for the full answer, code and interview guidance.

10 Results
171
SeniorAdvanced

What is DbContext in Entity Framework Core?

DbContext represents a session with the database and coordinates querying, change tracking, and saving entities.

172
SeniorAdvanced

What is change tracking in EF Core?

Change tracking allows EF Core to monitor entity instances and determine what INSERT, UPDATE, or DELETE operations are needed when SaveChanges is called.

173
SeniorAdvanced

What is AsNoTracking in EF Core?

AsNoTracking tells EF Core not to track entities returned by a query.

174
SeniorAdvanced

What is eager, explicit, and lazy loading in EF Core?

Eager loading retrieves related data as part of the query, commonly using Include and ThenInclude.

175
SeniorAdvanced

What is the N+1 query problem?

The N+1 problem occurs when an application executes one query to retrieve a list and then performs an additional query for each item to retrieve related data.

176
SeniorAdvanced

What is projection in EF Core, and why is it important?

Projection uses Select to return only the fields required by the application instead of loading complete entity objects.

177
SeniorAdvanced

How should pagination be implemented with EF Core?

Pagination prevents large datasets from being loaded into memory or sent to the client at once.

178
SeniorAdvanced

What are transactions in EF Core?

A transaction ensures that a group of database operations succeeds or fails as a unit.

179
SeniorAdvanced

What is optimistic concurrency in EF Core?

Optimistic concurrency assumes that conflicts are relatively uncommon and allows multiple users to read data without locking it for the duration of their work.

180
SeniorAdvanced

How would you optimize a slow EF Core query?

Start by measuring and inspecting the generated SQL rather than assuming EF Core itself is the problem.