EF Generate Primary Key from Sequence

Discussion of open issues, suggestions and bugs regarding Entity Framework support in ADO.NET Data providers
Post Reply
otaviosoares
Posts: 7
Joined: Fri 22 Aug 2014 19:07

EF Generate Primary Key from Sequence

Post by otaviosoares » Fri 22 Aug 2014 21:26

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

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

Re: EF Generate Primary Key from Sequence

Post by Shalex » Mon 25 Aug 2014 13:28

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.

otaviosoares
Posts: 7
Joined: Fri 22 Aug 2014 19:07

Re: EF Generate Primary Key from Sequence

Post by otaviosoares » Mon 25 Aug 2014 18:34

Thank you very much Shalex, it worked.

Post Reply