Database-first solution.
I'm using two tables called User
and Profile
. They are both using uniqueidentifier
(SQL Server) as their primary key. The way I let User
to automatically receive it's own guid id was from:
Open my edmx file.
Right click the Guid column for User -> Properties -> change the StoreGeneratedPattern to Identity.
Worked like a charm. Now I tried to do same with Review
, but I'm getting the following error every time I'm trying to create a new row:
Cannot insert the value NULL into column 'Id', table 'xxxx.dbo.Profile'; column does not allow nulls. INSERT fails. The statement has been terminated.
If I don't use Identity
for StoreGeneratedPattern
for Profile
, it will not generate a unique ID, instead just bunch of zeros which lead to duplicated error if I try to create a new row again.
Why is User working fine but not Profile
?
I followed this guide guide for both tables.