Page 1 of 1

Oracle, autoincrement, and Entity Framework

Posted: Mon 05 Oct 2009 15:12
by Marc44
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

Posted: Tue 06 Oct 2009 08:37
by AndreyR
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.

Posted: Tue 06 Oct 2009 15:26
by Marc44
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!