Linq To Sql - primary key syntax

I use LINQ To SQL and create my database using the CreateDatabase method. I understand from MSDN that the syntax for creating an automatically generated primary key field is

[Column(Storage="_ID", IsPrimaryKey=true, AutoSync=AutoSync.OnInsert, DbType="Int NOT NULL IDENTITY", IsDbGenerated=true)]

Can someone explain to me what this means AutoSync.OnInsert and what is the use of the other members of the AutoSync enumeration? .Ie. AutoSync.Always, AutoSync.Default, etc.

And what is the meaning of the word "Identity" in DbType when I already specified the column as a primary key?

0
source share
1 answer

Identification means that the identifier column has an auto-generated value that will be automatically inserted into any insert. When you insert a row, the first time the ID value will be 1 the next time 2, etc.

AutoSync CLR .

: , , OnUpdate, OnInsert.

: ( Entity ). , Linq2Sql .

+1

All Articles