Wednesday, May 26, 2010

Cannot add an entity with a key that is already in use, LINQ

When you have table with ID coulumn (uniqueidentifier) and default value = (newid()),
than the above error occur.

To Resolve:

1) go to your .DBML file design view
2) go to property of particular columns
3) set "Auto generated Value" = true.

it will add following in DBML file IsDbGenerated="true"

No comments: