Page 1 of 1

Linq with Sequence?

Posted: Wed 12 Nov 2008 01:43
by dqminh
Hello,

I'm a new person of this forum. Before google it, I use NHibernate in my project. Now, I decide to use a pro component in my new (and big) project.

I have downloaded oradirect.net, and Linq to Oracle, and it surprise me :D

But, the question is if I want to assign sequence to primary key in a insert query, how do I do? In Schema Modeler, on class editor -> property editor, I found the checkbox Auto Generated Value, but, maybe it doesn't work?

Posted: Fri 14 Nov 2008 12:06
by Shalex
You are right, you need to use the Auto Generated Value property. If you experience any difficulties, please send us a test project and a script to help us reproduce the problem.

Posted: Fri 14 Nov 2008 12:30
by dqminh
Thank you for reply. The problem is I don't know how to assign primary key with sequence. For example, I have a sequence name seq_Message, how do I assign it to primary key MessageId in table Message (with Linq for Oracle)?

Posted: Fri 14 Nov 2008 14:17
by Shalex
We recommend you to create OnInsert trigger in your database that will insert the next value of seq_Message into MessageId of table Message, and to use the Auto Generated Value property for the MessageId column in Entity Developer (new name of Schema Modeler in dotConnect for Oracle).

Posted: Tue 24 Mar 2009 12:22
by Zoran
Is there a simpler way? Why don't you omit the sequence column from the generated SQL INSERT statement?

Posted: Wed 25 Mar 2009 09:07
by AndreyR
Thank you for the inquiry. We will investigate the possibility of adding some alternative ways for Sequence handling.