2. The LINQto SQLAPI hands the query off to the LINQto SQL Provider.
3. The LINQto SQL Provider converts the LINQquery to T-SQL.
4. The LINQ to SQL Provider hands the new query off to the ADO Provider for execution on
the server.
5. The query is executed and the results are handed back to the ADO Provider in the form of
a DataReader.
6. The ADO Provider hands the DataReader back to the LINQ to SQL Provider.
7. The LINQ to SQL Provider converts the DataReader into an enumerable form of user objects.
218
Chapter 11: LINQ to SQL Queries
Realistically, a few of these steps could have been combined, but they are listed separately to provide a
detailed look at what happens when a LINQ to SQL query is executed. These steps also look like they
could take a while to process. On the contrary, LINQ to SQL was architected with performance in mind
from the get-go, and as you start working with LINQ and LINQ to SQL, you will notice that it indeed
works quickly.
To execute a query, a connection to the data source must first be established, and that is accomplished
through the DataContext class.
Pages:
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358