While LINQ to SQL may
not offer any speed advantages over previous or existing technology, it does offer the capability to
build applications more quickly and efficiently.
This chapter discusses the fundamentals and concepts that programmers need to know to work
with LINQ to SQL, including the following:
??‘ Overview of LINQ to SQL
??‘ LINQ to SQL object model
??‘ Attribute-based mapping
??‘ Relational data basics
Part III: LINQ to SQL
Understanding LINQ to SQL
As mentioned, LINQ to SQL is a part of ADO.NET and a component of LINQ. As such, you get the benefit
of the unified programming model, standard query operators, and standard query facilities provided by
LINQ, plus the services provided by the ADO.NET provider model.
LINQ to SQL works by mapping the data model of a relational database object, such as a table, to an
object model defined in the developer??™s chosen programming language. For example, the following code
maps the Person.Contact table of the Adventureworks database to a public class defined in C#. A public
class is defined, and mapped by annotating the class with the LINQ TableAttribute, passing it the name
of the SQL Server table to map to using the attribute??™s Name parameter.
Pages:
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330