Auto Generated Value is not available in Delphi

Discussion of open issues, suggestions and bugs regarding EntityDAC
Post Reply
davidizadar
Posts: 4
Joined: Thu 20 Apr 2017 19:44

Auto Generated Value is not available in Delphi

Post by davidizadar » Mon 24 Apr 2017 23:36

According to EntityDAC's help file, it is possible to define Entity Keys which can be auto-generated by the underlying database. It is a good feature because in databases like Oracle it is necessary to define a sequence and create a trigger for assigning sequence values to the primary key.
I'm using SQL Server 2016 and the option to enable this particular feature for my Entity Keys is just missing in action.
I tried defining the primary key in the database as IDENTITY and synchronized the model from the database. The Entity Key was showing the correct SQL type (ID NOT NULL IDENTITY), but it was lost the next time I updated the database from the model.
I assume that this is just a regression bug.

davidizadar
Posts: 4
Joined: Thu 20 Apr 2017 19:44

Re: Auto Generated Value is not available in Delphi

Post by davidizadar » Thu 27 Apr 2017 17:55

No one answered, but I found the answer.
The property Auto Generate Value is not shown and updating from the database only updates the SQL type to NOT NULL IDENTITY.
But I found that it is possible to define the field property IdGenerator to Identity in the property dialog shown to the left bottom in Entity Developer.

AlexP
Devart Team
Posts: 5530
Joined: Tue 10 Aug 2010 11:35

Re: Auto Generated Value is not available in Delphi

Post by AlexP » Wed 17 May 2017 07:21

Hello,

The field type, as well as the Entity Key attribute is determined from the database, you should determine the behavior for generating keys in the model by yourself by selecting the generator type using the IdGenerator property

Post Reply