In my application I have a model Client with int primary key Id. (model generated from database by metalsql)
var c = new Client{Name = "jonny"};
myDbContext.Client.InsertOnSubmit(c);
This code causes an error when I add the second client, because it turns out it Id field isn’t being incremented. It just takes the default value of 0. Is there a smart way to make this autoincrement work?
In your current table your column ID is not set to int is identity so you need to supply it.
To solve this make sure your table ID column is Set to int is identity to make your code works
See this link:
Creating A Database In Microsoft Visual Studio 2010
Best Regards