Edward Tanguay
Edward Tanguay

Reputation: 193302

Any reason to use "Entity SQL" if you can use LINQ?

Reading a book on Entity Framework and they say that LINQ is only available for C# and VB.NET. But for other languages you can use Entity SQL.

If you are doing a project in C#, is there any reason to use Entity SQL anyway? Any experiences with this?

Upvotes: 0

Views: 672

Answers (3)

VdesmedT
VdesmedT

Reputation: 9113

Performance !

By using Entity SQL, you bypass the Linq expression compilation which can be sometimes very costly (30% improvement is often mentioned).

Upvotes: 0

TFD
TFD

Reputation: 24524

Maybe it could be for something that can't be expressed in Linq?

Though best to rethink what you are doing though because this is usually the hint of smelly code instead as Linq is fairly complete

Some people may want to use it for dynamic filters or orderbys, but probably best to use a mix of Linq and Dynamic Linq

See

Is there a way I can dynamically define a Predicate body from a string containing the code?

Upvotes: 2

mathieu
mathieu

Reputation: 31192

It depends the "size" of your project.

On a project with very few entities, and if you're not afraid to put your linq2sql in presentation layer, it can do the trick.

Regarding Entity Framework, the lack of implicit lazy loading makes it a no go for me.

I'd go for ActiveRecord or NHibernate.

Finally, you can have a look at this post : Is LINQ to SQL Dead or Alive?

Upvotes: 0

Related Questions