ADO .NET, Entity Framework and LINQ to SQL - I got confused
I need to arrange those concepts in my head:
Does Entity Framework is "the new" ADO .NET? What is the difference between 开发者_运维百科those two terms? And how does LINQ to SQL related to each one? Is it part of the entity framework?
Entity Framework is an O/R mapper which is built on top of ADO.NET. LINQ to SQL is another alternative O/R mapping approach, but as far as I know, Microsoft goes for Entity Framework in future rather than LINQ to SQL.
ADO.NET is part of the .NET Framework. It consist of some libraries that can manage access to database systems.
LINQ to SQL is kind of a translator that let you use your database tables like objects. It is part of the .NET 3.5 Framework. It will translate object queries in sql. The db access can be ADO.NET as well.
The Entity Framework (aka ADO.NET Entity Framework) is a ORM framework which means that it will create you a layer between entities and database, the db access will be ADO.NET (although it could be something else)
As many of the respondents said already LINQ 2 SQL and Entity Framework are built on top of ADO.NET. Microsoft did not have a presence in Object Relational Mapping (ORM) space. After LINQ was released they came up with a stop gap solution in the form of LINQ 2 SQL. This works only with SQL Server database.
Entity Framework can be said as the first true ORM from MS which can work with all SQL complient databases. The learning curve is very small if someone knows about the LINQ 2 SQL. Microsoft reccomends that for all future data access related solutions Entity Framework should be an ideal choice.
Hope this helps.
精彩评论