Nevada
Nevada

Reputation: 93

Does a LINQ to Entities query eventually get translated into Entity SQL?

If I write a LINQ to Entities query does that get translated to a native query that the provider understands (i.e. SqlClient)?

OR

Does it get translated to Entity SQL that the Entity Framework then translates to a native query and passes to the provider?

If it gets translated to Entity SQL where I would I be able to see the Entity SQL that was generated?

If my question reveals that I'm totally screwed up in my thinking please set me straight!

Upvotes: 4

Views: 383

Answers (1)

Craig Stuntz
Craig Stuntz

Reputation: 126547

LINQ to Entities does not get translated to Entity SQL. Both LINQ to Entities and Entity SQL go to what is called a "Canonical Command Tree" which the provider then converts to store-specific SQL. I've seen a couple of people who should know better claim otherwise, but MS documentation indicates the above is correct.

alt text
(source: microsoft.com)

Upvotes: 3

Related Questions