Reputation: 309
When adding a new Entity Framework object to a database, how could one have SQL Server generate a sequential primary key for that object?
Edit:
Apparently by creating the table using a query which defines the primary key as IDENTITY (1, 1):
CREATE TABLE TableName(ID int PRIMARY KEY IDENTITY (1, 1), [other columns])
Upvotes: 2
Views: 2874
Reputation: 309
By creating the table using a query which defines the primary key as IDENTITY (1, 1):
CREATE TABLE TableName(ID int PRIMARY KEY IDENTITY (1, 1), [other columns])
Upvotes: 3