Mapping Columns
Once the table is mapped to an entity class, table columns must be mapped to class properties. The
Column attribute maps a column of a database table to a member of an entity class. Fields or properties
are designated to represent database columns, and only those fields or properties that are mapped are
retrieved from the database.
The following table describes the Column attribute??™s properties.
203
Part III: LINQ to SQL
Property Description
Default Value
(if any)
Name Name of the table column.
DbType Database type of the database column.
Storage The entity class storage field/variable.
IsPrimaryKey Specifies that the associated column is the primary
key of the corresponding table.
false
IsDbGenerated Specifies that the associated column auto-generates
its values.
false
CanBeNull Specifies that the associated column can contain
null values.
true
AutoSync Tells the runtime to get the column value after an
INSERT or UPDATE operation has been executed. It has
four options: Always??”Always returns the column
value for an INSERT or UPDATE operation.
Pages:
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337