Are Linq to SQL and Linq to Objects queries the same? -


If we exclude the datacontext, then are the L2S and L2O queries similar?

The prototype that I am already working on, which shows it, but it is very simple and is surprised if he would ask more advanced questions.

Do anyone know?

No, they are not the same.

Work on the LINQ archive for object queries. Collects the collection through collection and executes the sequence of methods against the objects in the collection (for example, etc.).

Work on SQL queries from LINQ. The query is converted to an expression tree by the compiler and that expression tree is translated into SQL and the database is passed.

It is common for LINQ to SQL that a method can not be translated into SQL, though that method works perfectly in the object query in LINQ. (In other cases, you can not see the exception, but the query results can vary between the objects from LINQ and the LINQ to the SQL.)

For example, LINQ to SQL The simple query will be disturbed, while the object with LINQ will be correct:

  var query = name by name n.LastName.TrimStart (',', ''). ToUpper (), n.FirstName.TrimStart (',', '') Select the new {n.FirstName, n.LlastName}; (It is often possible to resolve these limitations, but the fact is that you can not guarantee that any arbitrary LINQ has to work with the object query because the SQL query from LINQ Tell me that they are not!) 


Comments

Popular posts from this blog

c++ - Linux and clipboard -

What is expire header and how to achive them in ASP.NET and PHP? -

sql server - How can I determine which of my SQL 2005 statistics are unused? -