Page 1 of 1

Store generated Guid as key does not work on Azure

Posted: Wed 15 Jan 2014 17:10
by mover
I am using Entity Developer 5.5 with EF 5 and an Azure MS SQL database. SQL Server/Azure is set in the model properties as the target server/version.
I want to use GUIDs as a primary key, and the keys should be generated by the database. However, when doing this, Entity Developer generates SQL statements with the function "newsequentialid()". This function is not supported on Azure.
How can I tell Entity Developer to use the "newid()" function, which is supported?

Re: Store generated Guid as key does not work on Azure

Posted: Wed 15 Jan 2014 21:50
by strandedpirate
Which template are you using?

Try setting the Store Generated Pattern property for that column in Entity Developer to Identity and over in sql server management studio set a default value for that column of newid()

Sql Server Management Studio:

Image

Entity Developer:

Image

Re: Store generated Guid as key does not work on Azure

Posted: Thu 16 Jan 2014 12:28
by Shalex
We have reproduced the issue: if Model Settings > Synchronization > Mapping > Server Version is set to Azure, the Generate Database Script and Update To Database wizards of Entity Developer generate "DEFAULT NEWSEQUENTIALID()" for the property with Nullable=False, Store Generated Pattern=Identity, Type=Guid (in SSDL: Type=uniqueidentifier). We will notify you when the problem is fixed.

As a temporary workaround, please set Default Value=newid() for the storage column explicitly in the Store (SSDL) part of the model. Entity Developer allows to modify the Storage part of the model in design time: you can navigate to the storage column in Model Explorer OR select entity property > right click > Select Storage Object.

Re: Store generated Guid as key does not work on Azure

Posted: Mon 27 Jan 2014 10:25
by Shalex
The bug with generating NEWID() by Generate Database Script/Update Database From Model wizards for non-nullable Guid Identity property when 'Server Version=Azure' is fixed. We will notify you when the corresponding build of Entity Developer is available for download.

Re: Store generated Guid as key does not work on Azure

Posted: Thu 30 Jan 2014 16:00
by Shalex
New build of Entity Developer 5.7.286 is available for download!
It can be downloaded from http://www.devart.com/entitydeveloper/download.html (trial version) or from Registered Users' Area (for users with active subscription only).
For more information, please refer to http://forums.devart.com/viewtopic.php?f=32&t=28822.