Print Page | Close Window

Negative temporary ID inserted as into Identity Column... Why?

Printed From: IdeaBlade
Category: DevForce
Forum Name: DevForce Classic
Forum Discription: For .NET 2.0
URL: http://www.ideablade.com/forum/forum_posts.asp?TID=895
Printed Date: 05-Apr-2025 at 7:31am


Topic: Negative temporary ID inserted as into Identity Column... Why?
Posted By: brentvee
Subject: Negative temporary ID inserted as into Identity Column... Why?
Date Posted: 22-Jul-2008 at 11:05pm
Hey Guys

We have been using IdeaBlade for the last 2 years and are still a very happy users. :)

Recently though we have been having a problem with what we think might be the framework, and cannot seem to fix it.
We create an entity as we have always done using CreateEntity<> on the persistence manager. When calling SaveChanges() on the persistence manager though, the temporary ID assigned to this entity (which is -100) is inserted into the Identity column in the table. According to a sql trace, IdeaBlade does not seem to request a next available ID from the database.

To try and isolate the problem, we use the same section of code in a test project, and this time the ID is requested. So the difference between the two cases, is that in the test, the persistence manager being used is the default manager and in the above case, the persistence manager is being instantiated with a specific data source key extension, and a custom DataSourceKeyResolver is being used. To our knowledge, we have not yet had any problems when using a custom DataSourceKeyResolver, so I dont think we are doing anything incorrect there. The problem is simply that IdeaBlade is not requesting a next available ID from the database.

Any help will be greatly appreciated as this small problem is giving us alot of downtime with development.

Regards
Brent



Print Page | Close Window