Values lost after insert

Values lost after insert

Old forum URL: forums.lhotka.net/forums/t/5610.aspx


peterdougstuart posted on Thursday, October 16, 2008

Hi

I am upgrading a bunch of code from CSLA 1.0 to 3.5. I have a DataPortal_Insert method which puts some values into the database but also gets a few values back e.g. db identity key. As I debug through DataPortal_Insert everythings seems ok i.e. the values go into the DB and the identity key comes back fine. However when the object comes back to the UI it seems to have forgotten the identity key i.e. the object seems to be in exactly the same state as it was before save was called and has not retained the values that were changed in DataPortal_Insert.

My DataPortal_Fetch methods work fine. My guess is the problem is something to do with object serializable / unserialization however I'm at a bit of a dead end so could really use any pointers. I am using local objects i.e. no application server.

Any help would be great!

Cheers

Peter

sergeyb replied on Thursday, October 16, 2008

Just a guess – are you missing myObject = myObject.Save(), replacing the old object with newly saved one?

 

Sergey Barskiy

Principal Consultant

office: 678.405.0687 | mobile: 404.388.1899

cid:_2_0648EA840648E85C001BBCB886257279
Microsoft Worldwide Partner of the Year | Custom Development Solutions, Technical Innovation

 

From: peterdougstuart [mailto:cslanet@lhotka.net]
Sent: Thursday, October 16, 2008 4:04 PM
To: Sergey Barskiy
Subject: [CSLA .NET] Values lost after insert

 

Hi

I am upgrading a bunch of code from CSLA 1.0 to 3.5. I have a DataPortal_Insert method which puts some values into the database but also gets a few values back e.g. db identity key. As I debug through DataPortal_Insert everythings seems ok i.e. the values go into the DB and the identity key comes back fine. However when the object comes back to the UI it seems to have forgotten the identity key i.e. the object seems to be in exactly the same state as it was before save was called and has not retained the values that were changed in DataPortal_Insert.

My DataPortal_Fetch methods work fine. My guess is the problem is something to do with object serializable / unserialization however I'm at a bit of a dead end so could really use any pointers. I am using local objects i.e. no application server.

Any help would be great!

Cheers

Peter



peterdougstuart replied on Thursday, October 16, 2008

Wow! That's done it. Thanks so much!!! You have made me very happy, I was well and truly stuck.

 

Copyright (c) Marimer LLC