NET connection, in that it is initialized
with a connection or connection string.
Once the DataContext is created, a table variable is constructed using the Contact class created above.
This is done by using the Table class of the System.Data.Linq namespace, which provides the capability
to query a table and even add and delete objects. LINQ to SQL works with objects. Meaning, in LINQ to
SQL a relational database??™s object model is directly mapped to an object model expressed in your selected
programming language. Thus, a translation takes place. LINQ to SQL translates the LINQ queries of
the object model into statements that SQL can understand and then sends them off to SQL Server for
execution. The reverse happens when the data is returned. The results are translated back to objects that
you can work with.
Access to the table is accomplished by using the GetTable method of the defined DataContext,
like this:
Table
contact = context.GetTable();
Now you??™re ready to query the database using the same LINQ query operators and query facilities that
you have come to love.
Pages:
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332