Entity Framework Interview Questions
What is ADO.NET entity framework?
Entity framework is an ORM (Object Relational Mapping) framework developed by Microsoft.
It is an extension of ADO.NET that provides an automated mechanism to access and store data in the database. With the help of ADO.NET in Entity framework, database can be accessed without much required programming or code.
What is the key advantage of using Entity Framework or EF
Entity framework reduces a lot of time during the development process.
using Entity Framework or EF is that it generates code automatically for the Model (Middle Layer), Mapping code and Data Access Layer.
What is .edmx file? what does it contain?
.edmx is a configuration file in form of XML, which declares a conceptual model, a storage model and the mapping between these models. It has three categories SSDL, CSDL, and MSL, It consists the information that is used by ADO.NET entity data model designer to render a model graphically. It consists of all the mapping details of how object maps with SQL tables.
What is the difference between Entity Framework and ADO.NET?
|Ado.net is faster, Performance is better than Entity Framework.
||Entity Framework will be used with ADO.NET, Entity Framework will be slower than Ado.net
|In Ado.net, we need to write so much code for CRUD operation.
||As an Entity Framework will talk to database without much code involved, Easy to use
We need to write so much code to talk to database.
What are the difference between Entity Framework and LINQ to SQL
|LINQ to SQL
|Allows only one-to-one mapping between the entity classes and the relational tables.
||Allows one-to-one, one-to-many & many-to-many mappings between the Entity classes and the relational tables.
|Supports only for SQL database.
||Supports databases like SQL, MySQL, Oracle, DB2 etc
|.dbml file is generated for maintaining the relationships.
||Relationships are maintained in 3 different files - .csdl, .msl and .ssdl
What are the parts of Entity Data Model (EDM)?
- Conceptual Model
- Storage Model
What does .edmx consists of?
.edmx file is a XML file and it has Conceptual Model, Storage Model and Mapping details i.e,
- SSDL (Store schema definition language)
- CSDL (Conceptual schema definition language)
- MSL (Mapping specification language)
How to create Entity Data Model (EDM)?
Add New Item to solution -> ADO.NET Entity Data Model, which generates file with .edmx extension.