Insert_Identity error trying to update Class added to Module

Matthew White asked on May 15, 2014 09:40

I created a module in Kentico 8, and added a Class to this module - TransactionRegistrationPost. I went to the Code tab, and clicked to generate and then save the code. But when I try to use the InfoProvider class to insert an entry into this class, I get the error:

Cannot insert explicit value for identity column in table 'SagePay_TransactionRegistrationPost' when IDENTITY_INSERT is set to OFF.

I am not trying to programatically set a value for the GUID column, and cannot find any settings within the Kentico portal or properties on the Info or InfoProvider classes to change this.

What am I doing wrong? I have searched the documentation but could not find any mention of this

Recent Answers


Brenden Kehren answered on May 15, 2014 11:04

What hotfix are you on? There were a few bugs with modules and creation in the initial releases that were fixed later on. If you have the ability, upgrade to the latest hotfix.

0 votesVote for this answer Mark as a Correct answer

Matthew White answered on May 16, 2014 04:10

Thanks Brenden, I have upgraded to the latest hotfix and the issue still occurs. After a bit more testing I have found that it only happens if when creating the class, I create the GUID field with a field type of 'Primary Key' instead of 'Standard field'.

0 votesVote for this answer Mark as a Correct answer

Yehuda Lando answered on May 17, 2014 14:38

Make sure you specify the ID column when you instantiate the ObjectTypeInfo. It's the fourth parameter.

0 votesVote for this answer Mark as a Correct answer

Yehuda Lando answered on May 17, 2014 14:40

Also, I always used int columns for the primary keys. So you might also need to specify the guid column.

0 votesVote for this answer Mark as a Correct answer

   Please, sign in to be able to submit a new answer.