entity framework 5 - from a point of view of performance, is the same extended methods than linq to entities? -


when work entity framewrk, if not wrong terminoly, can use linq entities , extended methods.

i name linq entities query:

var myresult = (from c in mycontext.customers                 c.id >= 35                 select c).list(); 

and name extended methods way:

list<customers> lstresult = mycontext.customers.where(c=>c.id >= 35).tolist(); 

in both cases same result, wonder if 1 way more efficient other, because in both case ef must convert query t-sql.

thanks.

it's same. declarative query syntax (your first code snippet) gets translated @ compile time methods call standard query operators/extension methods (your second code sippet) (brief reference here).

in end compiled code same , code (linq entities), when runs, performs translation sql. choosing snippet 1 or 2 matter of personal taste , preference. however, can use extension method syntax because not supported methods have counterparts in query syntax.


Comments

Popular posts from this blog

c++ - Creating new partition disk winapi -

Android Prevent Bluetooth Pairing Dialog -

VBA function to include CDATA -