A project I'm currently working on has just switched from int IDENTITY to Guids for their primary keys, populated by newsequentialid(). I've regenerated the DAL, and am now in a position where new items committed to the db are generating guids correctly in the table, but aren't populating the PK in the item. I'm using the repository pattern.
For example:
CREATE TABLE tblItem
(
ItemId uniqueidentifier DEFAULT (newsequentialid()) NOT NULL PRIMARY KEY,
Description NVARCHAR(255) NOT NULL
)
Item item = new Item();
item.Description = "Bow chicka wow-wow.";
DB.Save(item);
Console.Writeline(item.ItemId);
// Outputs Guid.Empty where db reports 2F1FC274-76A2-DD11-8F92-000C29CA8213
After a bit of googling, I was unable to determine if this has been resolved or not. Relevant work items appear "closed" but with no explination as to resolution, and all I appear to get from the forums at this point is confusion. Currently using 2.1 Final.