1. Back To Blog

C# Entity framework interview questions with answers: - What is the difference between POCO, code first and simple EF approach?

All these three approaches define how much control you want on your code. Entity framework is an OR MAPPER it generates lot of code, it creates your middle tier (Entity) and Data access layer (Context).

 

But lot of times you want to enjoy benefits of both the world you want the auto-generation part to minimize your development time and also you want control on the code so that you can maintain code quality.

                                  


Below is the difference table which defines each of the approaches. In Simple entity framework everything is auto generated and so you need the EDMX XML file as well. POCO is semi-automatic so you have full control on the entity classes but then the context classes are still generated by the EDMX file.

 

In code first you have complete control on how you can create the entity and the context classes. Because you are going to manually create these classes you do not have dependency on the EDMX XML file. Below is a simple table which shows the cross comparison.

 

 

EDMX

Entity

Context

Simple entity framework

Needed

Auto

Auto

POCO approach

Needed

Manual

Manual

Code First

Not Needed

Manual

Manual

 

Below is a great ADO.NET Entity framework interview question video created by www.questpond.com which shows how to do CRUD using Entity framework.


Shiv Prasad Koirala

Visit us @ www.questpond.com or call us at 022-66752917... read more

We are on Social