Allow SQL to generate GUID ID when inserting new row.

For Database First:

If you having your inserts use Guid.Empty rather then generating a new ID see the above article. Using EDMX you need to edit every ID property in the EDMX and set the “StoreGeneratedPattern” to “Identity”.

Set the database table’s Id ‘s default property¬†newsequentialid().


For Code First:

In code first, rather than editing the EDMX, you simply put this attribute on each of your Id fields:

public Guid Id{ get;set; }