Labels

slider

Recent

Navigation

Entity Framework Interview Questions & Answers

Most frequently asked entity framework interview questions & answers for freshers, Entity Framework Interview Questions and Answers for freshers and experienced, Microsoft Entity Framework technical Interview questions and Answers , Microsoft Entity Framework interview tips ,Microsoft Entity Framework tutorials point interview questions
In the ASP.Net Web API Interview Questions, we have discussed the technical questions on Web API that could be asked in an interview. Yet, there is another important topic that needs attention. Here, you could find Microsoft Entity Framework technical Interview Questions and Answers. A thorough revision of the concepts could be established by following these questions and would also help as Microsoft Entity Framework interview tips.

Entity Framework Interview Questions & Answers

Q. 1 Most frequently asked entity framework interview questions & answers for freshers do contain this very basic one: What is an Entity framework?

An Entity Framework is something which specifies the relational mapping of objects. A Framework provides a mechanism to store and access data in the database automatically. It’s a very important concept of MVC model. There are various tools that are based on EF model. One such model is .NET.

Q. 2 What is the reason that one should choose entity framework ?

An Entity Framework helps the developers or programmers an easy mechanism to access the database without much knowledge of programming or coding.

Q. 3 What is the reason that one should choose entity framework ?

An Entity Framework helps the developers or programmers an easy mechanism to access the database without much knowledge of programming or coding.

Q. 4 Is the entity framework an open source project?

Yes, Entity Framework is an open source and is separated from .NET from the release of 6th version.

Q. 5 Point out the differences in performances while using entity framework and ADO.NET. This is a common question amongst the Entity Framework Interview Questions and Answers for freshers and experienced.

Entity framework is not as fast as ADO.NET.
Performance of Entity Framework is not as good as ADO.NET.
Entity Framework is easy to use, as accessing database does not involve much coding.

Q. 6 Mention what are all the components that are present in the Entity Framework architecture.
The various components Entity Framework consists of are

  • Entity Data Model (EDM)
  • Object Service
  • ADO.Net Data Provider
  • Entity SQL
  • LINQ to Entities
  • Entity Client Data provider

Q. 7 In what way did the Entity Framework affect the LINQ?

LINQ (Language Integrated Query) is a component of Entity Framework which actually helps the programmers to query the database without creating any stored procedures using a language similar to SQL.

Q. 8 What does lazy loading mean?

Lazy loading process delays the loading of related objects unless they are not required in the process, It only returns those objects that are required by the user and other related objects are returned when they are needed.

Q. 9 Enlist the Entity Data Model parts.

Storage model, Conceptual Model, and Mapping are the parts of Entity Model.

Q. 10 What do Pluralize and Singularize terms mean in Entity Framework context?

These terms are used as naming conventions for an object. Naming conventions are used for the better understanding and easy differentiation of elements in a program. This can be enabled while adding an EDMX file by selecting an option in the window, which will adhere to singular or plural coding convention.

Q. 11 What is the role of .edmx file in entity framework?

An EDMX file maintains a graphical view of mapping between the conceptual model, a storage model while declaring the models. This information is used by the ADO.NET entity model designers to render the model graphically. It also consists of all the mapping details of how object maps with SQL tables.

Q. 12 Explain the use of DbContext in entity framework?

DbContext is an important class in Entity Framework. Other classes that are derived from DbContext are known as context classes. It is used in creating the .edmx file.

Q. 13 What is the use of MSL?

MSL stands for Mapping Schema Language. It defines a Mapping Layer which connects the entity type definition from CSDL to the metadata definition in the SSDL. It is essential for .NET Classes to know the table structure and its relations.

Q. 14 Are primary and foreign keys supported in Entity Framework?

Yes. Entity Framework has both primary and foreign keys which can be defined in the database tables and imported or if the database is not set up, they can be created in the data model classes.

Q. 15 What are the properties that Entity Framework has?

Basically, three types of properties can be defined in Entity Framework. They are Navigational properties, Complex properties, and Scalar properties.

Q. 16 Differentiate between LINQ to SQL and Entity Framework.

LINQ to SQL
Entity Framework


It uses tight coupling approach
It uses loose coupling approach


It is based on DB first approach
It can use model first, DB first and code the first

approach


In this technique, the entity classes and relational
One to one, one to many and many to many
tables use one to one mapping
mapping is allowed between entity classes and

relational tables.


It creates .dbml file
It creates .edmx file


It uses DataContext file to query the database
It uses DbContext and ObjectContext files to

query the database


It enables rapid application development with
It supports SQL Server, DB2, and MySQL for rapid
SQL Server
application development


Q. 17 How do you handle concurrency in Entity Framework?

Entity Framework uses Client win and Store win actions to handle concurrent access to objects. It is handled using Locking techniques such as optimistic locking and pessimistic locking.

Q. 18 Define Navigation property.

The Navigation property stores or shows the relation between the tables. i.e., it points to related tables in the database model. The navigation properties help in understanding the structure of tables more precisely. These are the logical part of the data model.

Q. 19 What is a scalar property?

Scalar property or properties are those properties whose values are given in the entity. these are the entities that map to a single field in the storage model.

Q. 20 What is an Entity Set in Entity Framework?

An entity set is a collection of different entity types and mostly compared with database tables.

Q. 21 Briefly explain the role of POCO entity?

POCO stands for Plain Old CLR Objects – It is also called as Persistence – ignorant objects. These objects are used to implement the domain business logic of an application.

Q. 22 What does Code First Approach mean?

The code first approach provides a full control over the code. In this approach, the database is not designed rather it is generated from the code written in the form of POCO classes.

Q. 23 What are the disadvantages one can mention when Model First Approach is the choice?

The Model First approach does not give any control over the entities or database to the user.
Any additional features to be defined for the entities i.e., POCO entities then the user must use either T4 modify the template or use partial classes. It doesn’t provide any mechanism to update features directly.

Q. 24 Which entity states are supported in Entity Framework?

There are five states supported by Entity Framework. They are
Added state – In this state entity is tracked by context but does not exists in the database.
Modified – In this state entity is tracked by the context and exists in the database by modified values for some or all the properties
Deleted – In this state entity is tracked by the context and exists in the database but is marked for deletion.
Unchanged – In this state entity is tracked by context and exists in the database, but values of properties have not been changed from the database values.
Detached – In this state entity cannot be tracked by the context .i.e., permanently removed.

Q. 25 What measures can be taken to enhance the performance of Entity Framework?

You should avoid usage of views in firsthand.
Make it a practice to fetch only the necessary data from the Database.
A compiled query is always helpful and thus should be the approach one shall take.

Relevant Reading

Share

Anjan kant

Outstanding journey in Microsoft Technologies (ASP.Net, C#, SQL Programming, WPF, Silverlight, WCF etc.), client side technologies AngularJS, KnockoutJS, Javascript, Ajax Calls, Json and Hybrid apps etc. I love to devote free time in writing, blogging, social networking and adventurous life

Post A Comment:

0 comments: