Oracle, autoincrement, and Entity Framework

Oracle, autoincrement, and Entity Framework

Postby Marc44 » Mon 05 Oct 2009 15:12

Hello all,

I am trying to create an application that will support SQL Server and Oracle as a backend database using the Entity Framework. Have you guys found a way to support the auto increment feature for Oracle in the Entity Framework? I know SQL Server uses the autoincrement field and Oracle uses sequences which doesn't make the answer to keep the codebase between the two very simple.

Marc
Marc44
 
Posts: 7
Joined: Mon 05 Oct 2009 15:08

Postby AndreyR » Tue 06 Oct 2009 08:37

You should write a couple of triggers (on update and on insert) setting the value of the autoincrement column.
Then create the model and add StoreGeneratedPattern = "Identity" to the SSDL column definition.
AndreyR
Devart Team
 
Posts: 2919
Joined: Mon 07 Jul 2008 13:16

Postby Marc44 » Tue 06 Oct 2009 15:26

AndreyR wrote:You should write a couple of triggers (on update and on insert) setting the value of the autoincrement column.
Then create the model and add StoreGeneratedPattern = "Identity" to the SSDL column definition.


Beautiful thanks!
Marc44
 
Posts: 7
Joined: Mon 05 Oct 2009 15:08


Return to dotConnect for Oracle