Autogenerated GUID Primary Key

Autogenerated GUID Primary Key

Postby jpla2005 » Wed 28 Apr 2010 16:19

Hi all

I'm facing problems working with GUID autogenerated primary keys. I've a table with a Raw(16) primary key wich value is autogenerated using SYS_GUID() oracle function. Th problems is when I insert the first value (without setting the id value for the entity) this id takes a value "00000000000000000000000000000000" and of course, the second call throws an exception because a primary key violation. The problem seems that EF does not recognize this is a autogenerated value and passes the default value of this type when I don't provide another one. Please, how can I solve this problem?

thanks
jpla2005
 
Posts: 5
Joined: Wed 28 Apr 2010 16:09

Postby AndreyR » Thu 29 Apr 2010 13:59

Set the StoreGeneratedPattern attribute to "Identity" in the SSDL part of your model for the autoincrement Guid property. This should help.
AndreyR
Devart Team
 
Posts: 2919
Joined: Mon 07 Jul 2008 13:16

Postby jpla2005 » Thu 29 Apr 2010 16:54

Thanks a lot, this works fine.
jpla2005
 
Posts: 5
Joined: Wed 28 Apr 2010 16:09


Return to dotConnect for Oracle