Blog
.NET
ajaxcontroltoolkit
Best Practices
Blog
business tip
c#
Categories
comments
css
Database
email
Excel
flickr
GoDaddy
Google Analytics
Google Webmaster Tools
Hosting
IIS
Kentico CMS
linq
minne*
minnebar
MS SQL
MSSQL
MVC
MySQL
networking
peripheral
Rackspace Cloud
robots.txt
RSS
scripts
seo
service
sitemap.xml
Social Networking
tags
Title
trackbacks
training
twitter
Vista
Visual Studio
WordPress
xhtml
Linq to Sql- AutoID not working
July 31, 2009 Author: Joel
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.
-
Categories
- asp.net (12)
- Blog (3)
- Business (5)
- Conferences (1)
- Errors (5)
- Office (1)
- Portfolio (3)
- Reviews (3)
- SEO (4)
- SQL Server (4)
- Tips (2)
- Uncategorized (2)
- Web Development (14)
-
Archives