This question is locked. New answers and comments are not allowed.
richardFlow
Top achievements
Rank 1
richardFlow
asked on 01 Sep 2010, 12:09 AM
I am getting the following error:
It happens when I execute the following line:
The table is actually a view, and I've set 3 columns to be the primary key, with none of them set to "Auto Increment".
I can't find any help on line relating to this error message. Can you please advise?
Thanks!
Cannot use AUTOINC key generator on a table with multiple primary key columns
It happens when I execute the following line:
IObjectScope newScope = db.GetObjectScope();
The table is actually a view, and I've set 3 columns to be the primary key, with none of them set to "Auto Increment".
I can't find any help on line relating to this error message. Can you please advise?
Thanks!
6 Answers, 1 is accepted
0
Accepted
IT-Als
Top achievements
Rank 1
answered on 01 Sep 2010, 07:44 AM
Hi Web Belief,
I has something to do with your mapping - otherwise you wouldn't get it on your call to GetObjectScope (I believe this is the first call made..)
As far as I can read from your post you have checked the tables for not using "Autoinc" as a type for the keys. Have you also checked the mapping to the class that maps to the view?
I believe you should set up the Key Generator to "None"
Regards
Henrik
I has something to do with your mapping - otherwise you wouldn't get it on your call to GetObjectScope (I believe this is the first call made..)
As far as I can read from your post you have checked the tables for not using "Autoinc" as a type for the keys. Have you also checked the mapping to the class that maps to the view?
I believe you should set up the Key Generator to "None"
Regards
Henrik
0
richardFlow
Top achievements
Rank 1
answered on 01 Sep 2010, 10:11 AM
Yes! Thanks very much Henrik.
To clarify for anyone else reading, i had to remove the following line from the app.config file within the class in question.
I'm surprised we can't control this from the reverse mapping wizard!
Thanks!
To clarify for anyone else reading, i had to remove the following line from the app.config file within the class in question.
<extension key="db-key-generator" value="None" />
I'm surprised we can't control this from the reverse mapping wizard!
Thanks!
0
Hi Web and Henrik,
Petko_I
the Telerik team
We are glad you figured out how to solve the problem. We are constantly trying to automate the tasks when specifying options for a model. Feel free to share your suggestions for improvement with us. We are now concentrating our efforts mainly on the visual designer and slowly the old wizards are moving towards a maintenance mode. That is why you will not see many updates there.
Do not hesitate to contact us if you have any further questions.
All the best,Petko_I
the Telerik team
Do you want to have your say when we set our development plans?
Do you want to know when a feature you care about is added or when a bug fixed?
Explore the
Telerik Public Issue Tracking
system and vote to affect the priority of the items
0
Myth
Top achievements
Rank 1
answered on 26 May 2011, 09:18 AM
I just had a similar case with the entity designer.
I had a table that had a combined primary key with the following fields:
I changed the table so the varchar was also a foreign key to another table.
What happend was that the entity designer didn't delete the varchar property, and added the new primary key.
In the designer, i deleted the varchar property manually.
After this i had the autoinc exception.
By opening the rlinq file in an xml editor, i changed
to
And it solved the issue.
Kind regards,
Stijn
I had a table that had a combined primary key with the following fields:
- 1 int, foreign key to another table
- 1 varchar
I changed the table so the varchar was also a foreign key to another table.
What happend was that the entity designer didn't delete the varchar property, and added the new primary key.
In the designer, i deleted the varchar property manually.
After this i had the autoinc exception.
By opening the rlinq file in an xml editor, i changed
<
orm:identity
>
<
orm:key-generator
name
=
"autoinc"
/>
<
orm:multiple-field
>
<
orm:single-field
field-name
=
"_groupId"
/>
<
orm:single-field
field-name
=
"_controlId"
/>
</
orm:multiple-field
>
</
orm:identity
>
to
<
orm:identity
>
<
orm:multiple-field
>
<
orm:single-field
field-name
=
"_groupId"
/>
<
orm:single-field
field-name
=
"_controlId"
/>
</
orm:multiple-field
>
</
orm:identity
>
And it solved the issue.
Kind regards,
Stijn
0
Anders
Top achievements
Rank 2
answered on 27 Jun 2011, 04:35 PM
#Myth
Just wanna thanks Myth for his fix to this error.
Got the same error and opening the rlinq file in an xml editor solved my problem.
Just wanna thanks Myth for his fix to this error.
Got the same error and opening the rlinq file in an xml editor solved my problem.
0
Sri
Top achievements
Rank 1
answered on 01 Mar 2013, 02:49 AM
OMG, thanks for this fix, I had a problem just adding a new row, cause I changed the database to auto-increment and could not insert a row. I know I had to change the rlinq, I just didn't know how, till I found this thread, thanks so much