Share via


How to: Specify Database Data Types (LINQ to SQL)

Use the LINQ to SQL DbType property on a ColumnAttribute attribute to specify the exact text that defines the column in a T-SQL table declaration.

You must specify the DbType property only if you plan to use CreateDatabase to create an instance of the database.

For code examples, see DbType.

To specify text to define a data type in a T-SQL table

  1. Add the DbType property to the ColumnAttribute attribute.

  2. Set the value of the DbType property to the exact text that is used by T-SQL.

See Also

Concepts

The LINQ to SQL Object Model

Other Resources

How to: Customize Entity Classes by Using the Code Editor (LINQ to SQL)