call today Call Today 320.281.0605

Linq to Sql- AutoID not working

July 31, 2009

Using Linq to Sql Auto IDs do not work by default. 

Lets say you have a table “Property” with a primary key of “PropertyId”.  In the table definition it is set as a unqueidentifier and by default it is assigned a NewID().

Now go to your Linq to Sql and create your dbml, drag your Property table into it.

In order to have the PropertyId generated using the Default Value go  to the properties of the PropertyId field and set Auto Generate Value to True and Auto-Sync to OnInsert.

I am sure many already know this, but I hope it can help save some time for others. 

  • Share/Bookmark
blog comments powered by Disqus
Agent Cody Banks 2 Destination London full lenght movie download Afghan Knights download movie Inside the Smiths download movie Beverly Hills Chihuahua download movie Permanent Vacation download movie Indiana Jones and the Kingdom of the Crystal Skull download movie Afghan Knights download movie Inside the Smiths download movie Beverly Hills Chihuahua download movie Permanent Vacation download movie Indiana Jones and the Kingdom of the Crystal Skull download movie