7

I know the benefit of the LINQ and I know use of it in .Net Application. I fill same thing there are providing as a Entity Framework.

So What's Major Difference between LINQ and Entity Framework?

4 Answers 4

13

LINQ could be applied to any data source: in-memory objects, XML, SQL, ...

Entity Framework could use LINQ to perform queries against a relational database.

LINQ to SQL is the predecessor of Entity Framework and is obsolete now.

Sign up to request clarification or add additional context in comments.

1 Comment

As I'm using EF for enterprise solution, that get big and bigger model everyday so we have performance problem specially in the first initialization EF (or warming up it), I read this weblogs.asp.net/fbouma/… and now I'm hesitant if I must to change ORM or not? maybe using dapper(and I know it hasn't change tracking) or LLBLGenPro can be help! We are working on enterprise level solutions and I hope to know what you think about. Thanks so much.
8

Comparing EF and LINQ is incorrect. Both are different things and they often work together to give better developer experience (and productivity benefit).

LINQ is querying syntax/model that can be applied to any data source. EF provides one such data source.

2 Comments

Can you provide any tutorial link or artical link which can show me EF and LINQ using together?
@Mrugesh, I believe that almost every EF code sample on MSDN would be showing use of LINQ along with e.g. see this: msdn.microsoft.com/en-us/data/jj205424 where query part is LINQ. I hope that your are not confusing LINQ with LINQ to SQL - the later is ORM library (similar to EF) meant for SQL Server database (while EF targets any RDBMS).
2

They are somewhat similar, and can be used in a very similar way, code-wise, but they have some important differences. Note that "LINQ" is not the same thing as "LINQ to SQL"; the EF also uses LINQ. Some notable differences are:

  • LINQ to SQL is largely SQL Server only, not so much by design as by implementation. The EF is designed to support, and does support, multiple DBs, if you have a compatible ADO.NET provider.
  • Out of the box, LINQ to SQL has a very poor story for DB metadata changes. You have to regenerate parts of your model from scratch, and you lose customizations.
  • The EF supports model features like many-to-many relationships and inheritance. LINQ to SQL does not directly support these.
  • In .NET 3.5, LINQ to SQL had much better support for SQL-Server-specific functionality than the EF. This is mostly not true in .NET 4; they're fairly similar in that respect.
  • The EF lets you choose Model First, DB First, or Code First modeling. LINQ to SQL, out of the box, really only supports DB First.

SOURCE : Here

Comments

1

I totally agree with VinayC. You cannot really compare.

With Entity Framework, you will be able to have a whole representation of your database in your program. It will help you create classes corresponding to the database elements, connected together like they are in the database. You can after interact with elements of theses classes directly, and like this impact the database. You will have some representation of these classes diagram in visual studio. It's basically often simpler than working directly with the database elements, even if setting it up requires some effort.

The use of Linq is to perform queries on the data sources.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.