Transaction & IsDirty


Author
Message
Crones
Crones
StrataFrame Beginner (47 reputation)StrataFrame Beginner (47 reputation)StrataFrame Beginner (47 reputation)StrataFrame Beginner (47 reputation)StrataFrame Beginner (47 reputation)StrataFrame Beginner (47 reputation)StrataFrame Beginner (47 reputation)StrataFrame Beginner (47 reputation)StrataFrame Beginner (47 reputation)
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?
Reply
Trent Taylor
Trent Taylor
StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)
Group: StrataFrame Developers
Posts: 6.6K, Visits: 7K
We actually use transactions quite a bit in our medical app and so I know that it will work.  Now we did recently make a change to the transactions when dealing with foreign key values.  However, in you case I am a little confused as to what is going on...I didn't totally follow what you were trying to do.  The private that you are talking about cannot be access outside of the BusinessLayer.  However, if you create an inherited BO from BusinessLayer you should be able to get to that field (if nothing else through reflection).  But I would be more interested in what you are doing versus just trying to set that value as I think that just setting that will cause some other side-effects down stream.
GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...





Similar Topics

Reading This Topic

Login

Explore
Messages
Mentions
Search