The object model works through its relationship to the database
and the database model to perform given tasks. The following table shows the relationship between the
LINQ to SQL object model and the corresponding relational model.
201
Part III: LINQ to SQL
LINQ to SQL Object Relational Object
DataContext Database
Entity class Table
Class member Column
Association Foreign-key relationship
The following section explores LINQ to SQL object model mapping.
Attribute-Based Mapping
It is all about attributes when mapping SQL Server objects to the object model. This attribute-based
approach is utilized heavily by LINQ to SQL to effectively map database objects to an object model
defined in the user??™s programming language.
There are three ways to create attribute mapping:
??‘ The Object Relational Designer (ORD) tool
??‘ The SQLMetal command-line tool
??‘ By hand via code
So far, all the mapping has been done via code, but later chapters will discuss the other two options in
detail. You have seen several of the attribute-based mappings in action throughout this book, but the
following sections discuss the different attributes in more detail, including their associated properties
and descriptions.
Pages:
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334