Oracle, autoincrement, and Entity Framework

Discussion of open issues, suggestions and bugs regarding ADO.NET provider for Oracle
Post Reply
Marc44
Posts: 7
Joined: Mon 05 Oct 2009 15:08

Oracle, autoincrement, and Entity Framework

Post by 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

AndreyR
Devart Team
Posts: 2919
Joined: Mon 07 Jul 2008 13:16

Post by 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.

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

Post by 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!

Post Reply