2

I know ASP .Net and ADO .NET But I am really confused with this Entity Framework and LINQ. Can We Use Entity Framework to Interact with Db without like ADO .NET.Are all these three (ADO ,Entity framework,LINQ) is alternative to each other ?

Please guide

Rakesh jha
  • 83
  • 1
  • 12
  • follow this question : [Entity Framework vs LINQ to SQL][1] [1]: http://stackoverflow.com/questions/8676/entity-framework-vs-linq-to-sql – mahdi Oct 06 '14 at 11:46

2 Answers2

2

Here is my best explanation (after hours of confusion!):

ADO.NET = Part of the .NET framework enabling you to easily access data and data services like Microsoft SQL Server

LINQ (Language-integrated query) = Enables you to query data from within .NET programming languages

LINQ has been integrated in various areas of the .NET framework including:

  • LINQ to Objects
  • LINQ to XML
  • LINQ to ADO.NET

LINQ to ADO.NET = enables you to query over any enumerable object in ADO.NET by using LINQ

There are 3 LINQ to ADO.NET technologies:

  • LINQ to DataSet = enables you to write queries against the DataSet (a class that represents an in-memory version of a DB)
  • LINQ to SQL = enables you to write OO queries in your .NET project that targets SQL databases. It translates LINQ queries into SQL statements. This is no longer supported by Microsoft due to the great overlap in functionality with the Entity Framework (EF).
  • LINQ to Entities = Almost anything you can do in LINQ to SQL can be done in LINQ to Entities. Enables developers to write queries against the Entity Framework(EF) conceptual model using VB or C#.

EF is an Object Relational Mapper (ORM) that supports the development of data-oriented software applications. With EF, you can take a bunch of database objects like tables and turn them into .NET objects that you can access in your code. You can then use these objects in queries or use them directly in data-binding scenarios. EF also enables you to do the reverse: design an object model first and then left EF create the necessary database structure for you.

Source: Beginning ASP.NET 4.5.1, Microsoft Documentation

benscabbia
  • 17,592
  • 13
  • 51
  • 62
1

I assume that by LINQ you actually mean LINQ to SQL.

EF (Entity Framework) and L2S (LINQ to SQL) are object-relational mappers that use ADO.NET internally, encapsulating most of its functionality. So if you use either, you'd still be using ADO.NET.

All three are viable options for building the data access layer or your code, with their own strengths and weaknesses. Have a look at this post for more info:

Entity Framework VS LINQ to SQL VS ADO.NET with stored procedures?

Community
  • 1
  • 1
Saeb Amini
  • 23,054
  • 9
  • 78
  • 76