GUID primary key and "Value Generated": Add

Discussion of open issues, suggestions and bugs regarding Entity Developer - ORM modeling and code generation tool
Post Reply
RobertK
Posts: 111
Joined: Thu 02 Mar 2017 05:44

GUID primary key and "Value Generated": Add

Post by RobertK » Wed 26 Jun 2019 15:05

When you import from the database to models, and you have a GUID primary key "Id".
The "value generated" selected value is always "Never"
(Even if you first created the database from model, and then create the models from database again
The "value generated" selected value is always "Never")

Shouldnt primary key be default value generated to "Add"? or at least there should be an option to set primary key value generated to "add"?


Note: If I do not manually assign the primary key with a GUID identitifer, it creates an empty GUID value in the database
#postgres

Shalex
Site Admin
Posts: 9543
Joined: Thu 14 Aug 2008 12:44

Re: GUID primary key and "Value Generated": Add

Post by Shalex » Tue 02 Jul 2019 17:35

Please create the following table in your database:

Code: Select all

CREATE TABLE tbl 
(
  pkey UUID NOT NULL DEFAULT uuid_generate_v1() , 
  CONSTRAINT pkey_tbl PRIMARY KEY ( pkey )
)
And import it into your EF Core Model (*.efml). Entity Developer should set Value Generated=OnAdd for the Pkey property.

JIC: https://dba.stackexchange.com/questions ... n-postgres

Post Reply