Entity Framework Interview Questions and Answers
Ques 1. What is Entity Framework (EF)?
Entity Framework (EF) is an object-relational mapping (ORM) framework that enables developers to work with relational data using domain-specific objects.
Ques 2. Explain Code First approach in Entity Framework.
Code First is an approach where you define your data model using C# or VB.NET classes, and the database is generated based on these classes.
Ques 3. What is DbContext in Entity Framework?
DbContext is a class in EF that represents a session with the database, allowing you to query and save data.
Ques 4. Differentiate between DbSet and DbContext in Entity Framework.
DbContext is a representation of a session with the database, while DbSet is a collection of entities that are used to perform database operations on those entities.
Ques 5. Explain Lazy Loading in Entity Framework.
Lazy Loading is a feature in EF where related entities are not loaded from the database until they are explicitly accessed in code.
Most helpful rated by users: