views:

86

answers:

4

I was reading this article about ADO.NET Entity Framework and found it to be very interesting though in the first shot I could not decipher many things. I am reading the article again in order to fathom the real logic behind this.

a) A question cropped in my mind is why we need an ORM framework (in general)?

b) And among other ORM frameworks present for .NET like Spring.NET, Linq to Sql , NHibernate etc. why will we prefer ADO.NET Entity Framework?

A: 

a) an ORM framework abstracts away the boilerplate data layer access code: you simply deal with objects in code.

b) Depends on your circumstances and requirements.

Mitch Wheat
Sir, can you please be a bit detailed.
priyanka.bangalore
@priyanka.bangalore: only possible if you detail your actual requirements
Mitch Wheat
No sir, there is no project requirement as such. For my own sake to understanding only i asked :)
priyanka.bangalore
+1  A: 

Here's some of my thoughts:

a) ORM's exist to simplify and reduce the workload on the developer. In many well-designed relational models, the database can be accessed via code that is highly repetitive (just change a table name, column names, but the behavior is very similar). An ORM generates code that the developer can use right away, and tweak as necessary. The developer does not need to write SQL - that is the job of the ORM now. It also refreshes the generated code by automatically adjusting to database schema changes.

b) I don't know. It really depends on your requirements and dependencies. How involved do you want your ORM to be? How important is performance? How developer-friendly do you want the code to be? Entity Framework tends to generate a more comprehensive class library as the data-access layer, while giving you visual tools to tweak the generated code. Linq to SQL tends to be easier to sprinkle throughout different methods. That's just one example.

Jeff Meatball Yang
+2  A: 

EF is to create logical objects from the relational SQL tables. Generally, you want to reasonably match your physical tables with your objects, but sometimes it doesn't work that way. It promotes Persistence Ignorance.

Dr. Zim
+3  A: 

b. Subjective. I might not be able to offer a good opinion, as I have not used EF.

virtualmic