What is Entity Framework Core?
Why Interviewers Ask This
Mid-level C# / .NET roles require deep understanding of this topic. Interviewers ask this to separate candidates who truly understand the mechanics from those who only know surface-level concepts.
Answer
Entity Framework Core (EF Core) is Microsoft's official ORM (Object-Relational Mapper) for .NET. It enables working with databases using .NET objects, eliminating most data-access boilerplate. Core concepts: DbContext: the main class coordinating EF Core functionality — represents a session with the database. DbSet<T>: represents a table. Migrations: code-based database schema versioning (dotnet ef migrations add, dotnet ef database update). LINQ queries: translated to SQL — context.Users.Where(u => u.Age > 18).ToListAsync(). Two approaches: Code First (define C# models → generate DB), Database First (scaffold models from existing DB). Supports: SQL Server, PostgreSQL, MySQL, SQLite, Cosmos DB. Key patterns: repository pattern, unit of work (built-in via DbContext.SaveChanges()). Avoid N+1 with eager loading: .Include(u => u.Orders).
Pro Tip
Demonstrate both theoretical understanding and practical experience. Say what it is, then give an example of how you actually used it in a C# / .NET codebase.
Previous
What is dependency injection in ASP.NET Core?
Next
What is the difference between eager, lazy, and explicit loading in EF Core?
More C# / .NET Questions
View all →- Intermediate What is ASP.NET Core and how does it differ from ASP.NET Framework?
- Intermediate What is middleware in ASP.NET Core?
- Intermediate What is dependency injection in ASP.NET Core?
- Intermediate What is the difference between eager, lazy, and explicit loading in EF Core?
- Intermediate What is the Task Parallel Library (TPL) in C#?