Linq with Sequence?

Discussion of open issues, suggestions and bugs regarding LinqConnect – Devart's LINQ to SQL compatible ORM
Post Reply
dqminh
Posts: 28
Joined: Wed 12 Nov 2008 01:31

Linq with Sequence?

Post by dqminh » Wed 12 Nov 2008 01:43

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?

Shalex
Site Admin
Posts: 9543
Joined: Thu 14 Aug 2008 12:44

Post by Shalex » Fri 14 Nov 2008 12:06

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.

dqminh
Posts: 28
Joined: Wed 12 Nov 2008 01:31

Post by dqminh » Fri 14 Nov 2008 12:30

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)?

Shalex
Site Admin
Posts: 9543
Joined: Thu 14 Aug 2008 12:44

Post by Shalex » Fri 14 Nov 2008 14:17

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).

Zoran
Posts: 44
Joined: Thu 28 Apr 2005 21:55
Location: Zagreb, Croatia

Post by Zoran » Tue 24 Mar 2009 12:22

Is there a simpler way? Why don't you omit the sequence column from the generated SQL INSERT statement?

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

Post by AndreyR » Wed 25 Mar 2009 09:07

Thank you for the inquiry. We will investigate the possibility of adding some alternative ways for Sequence handling.

Post Reply