Page 1 of 1

EF Generate Primary Key from Sequence

Posted: Fri 22 Aug 2014 21:26
by otaviosoares
I'm testing dotConnect for Oracle and Entity Developer, both trial versions.

I want to let the database generate the entity's id based on a sequence nextval.

I'm currently following the steps described at http://blog.devart.com/set-identity-and ... ggers.html, but whenever I set the attribute's default value in Entity Developer to S_USER.NEXT_VAL I get an error like "Default value (S_USER.NEXTVAL) is not valid. Expected an integer between -9223372036854775808 and 9223372036854775807."

The procedures described at this link are out to date?

What I'm doing wrong?

Any help would be awesome
Thank you

Re: EF Generate Primary Key from Sequence

Posted: Mon 25 Aug 2014 13:28
by Shalex
Looks like you defined the Default Value property in CSDL. But you should set it in the SSDL part of the model instead. For this, navigate to Tools > Entity Developer > Model Explorer > *.Store > Tables/Views > select the needed StorageColumn and naviagate to its Default Value property. Save the model and check the generated SQL via dbMonitor.

Re: EF Generate Primary Key from Sequence

Posted: Mon 25 Aug 2014 18:34
by otaviosoares
Thank you very much Shalex, it worked.