Group: Forum Members
Posts: 35,
Visits: 345
|
So here is the scenario:
I have an inherited BO that generates an "AutoID" value based on other field values. This ONLY happens when a new record is created. Now what happens is during the very FIRST save, my BO creates a transaction and saves the record using a temporary value for the AutoID so I can retrieve the PrimaryKey value, and then update the AutoID value with the field values I need and re-save just the AutoID value using a command object. Once this completes the transaction is committed. (Subsequent saves doe not automatically use a transaction unless I tell it too.) So far, everything works great and I have a happy day continuing on my way. Now the kicker:
In my case I generally open a form, fill just the data I need, make a change, save and close. When opening the form again (thus refilling the BO) and make a change, save & close everything is fine and dandy, HOWEVER, if I open the form, create a NEW record, save and do NOT close the form, and begin modifying data and save again, my changes are NOT pushed back to the database. I traced this to the Base BusinessLayer's save event and checking on the IsDirty property which returns FALSE if _IsSavedOnTransaction is set to TRUE which happened because I initially saved the BO in a transaction but do not need to save in a transaction again.
My question here would be: Is there some way to reset the BO's _IsSavedOnTransaction property to false without refilling the data?
|