I had a running DO4 solution in pre-production.

We recently wanted to migrate data, so we created a new database and migrated data using SSIS. The migration was successful. I am using Data Objects .NET 4.4 on a SQL server 2008 R2.

Now when we try to add new data, we are getting

Entity is already detached from Session. Likely, this is result of creation of new Entity with the same Key.

Please help, as this is a production system. Your urgent help is very much appreciated.

asked Jun 20 '11 at 01:15

Akhtar's gravatar image


One Answer:

Hello Akhtar,

According to the exception text, entities are being created with keys that are already present in the database. I'd recommend you to check settings of Int32-Generator table and similar. By settings I mean the value of increment column. I suspect that these settings were not migrated properly.

answered Jun 20 '11 at 02:52

Dmitri%20Maximov's gravatar image

Dmitri Maximov

Dear Dmitri,

I checked the settings of Int32-Generator. The Identity Insert is set to Yes.

The value is Identity Increment 128, Identity Seed 128, when I created new database and migrated data.

How to change these settings.

Your support is highly appreciated.



(Jun 20 '11 at 02:56) Akhtar Akhtar's gravatar image

Akhtar, open your development database and execute the following command:


This will show you the current value of autoincrement column from Int32-Generator table. Take this value and update Int32-Generator.ID column identity seed value in pre-production database.

(Jun 20 '11 at 03:14) Dmitri Maximov Dmitri%20Maximov's gravatar image

Dear Dimitri,

I did the same and the issue is resolved. I really appreciate you guys at X-tensive. Great support!



(Jun 20 '11 at 03:45) Akhtar Akhtar's gravatar image

Akhtar, thank you too.

(Jun 20 '11 at 03:53) Dmitri Maximov Dmitri%20Maximov's gravatar image
Your answer
Please start posting your answer anonymously - your answer will be saved within the current session and published after you log in or create a new account. Please try to give a substantial answer, for discussions, please use comments and please do remember to vote (after you log in)!
toggle preview

powered by OSQA