This is a migrated thread and some comments may be shown as answers.

Auto Incrementing Int ID ( primary key )?

2 Answers 206 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Seabus
Top achievements
Rank 1
Seabus asked on 10 Nov 2011, 07:31 PM
Hi,

I'm trying to build a table using the SCHEMA EXPLORER / ADD TABLE function ... This table should have a primary key that is an
INT  and it should be auto incrementing :-)
How do I do this ?!
There's  no clear way of doing this :-)
See the attached image.

Sebastian


2 Answers, 1 is accepted

Sort by
0
IT-Als
Top achievements
Rank 1
answered on 11 Nov 2011, 11:39 AM
Hi Sebastian,

As per my understanding, this table design becomes a class (you map a class to the table)... in doing so, you can tell (on the class level) that this property is the identity of the class and that it is backend calculated.
After that, when you update your database (from the class model) your table meta data will be changes to be autoinc int

Regards

Henrik
0
Ivailo
Telerik team
answered on 15 Nov 2011, 08:11 AM
Hi,

First let me thank Henrik for the input - it is correct. The details for the resolution are the following:
1) Make the property an Identity as you have already done
2) Set the Identity Mechanism property of the Domain Class to DatabaseServerCalculated, as shown in this article.
3) After updating it to the database, it should be created as auto-incrementing primary key. 

Let us know if you need any clarifications or you have other questions.

All the best,
Ivailo
the Telerik team

NEW and UPDATED OpenAccess ORM Resources. Check them out!

Tags
General Discussions
Asked by
Seabus
Top achievements
Rank 1
Answers by
IT-Als
Top achievements
Rank 1
Ivailo
Telerik team
Share this question
or