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?
Replies
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
Thank the [deity] for source code!!! w00t



Found a bug in the StrataFrame BusinessLayer.

In the BusinessLayer's save method the existing code is:



If Transactional Then

...

If _BosOnTransaction.TryGetValue(Me._DataSourceKey & "|" & Transactional, list) ...

...

End If



Which should be:



If Transactional Then

...

If _BosOnTransaction.TryGetValue(Me._DataSourceKey & "|" & TransactionKey, list) ...

...

End If



I changed this, compiled and ran it and everything worked as expected.





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
I will take a look at this in the morning and make sure that there isn't something else that was missed.  Good job and thanks for the tip.  Sorry I didn't get to this sooner Blush I have been running around with 1000 things up in the air this week...it was on my list but I just had not gotten to it...out of the norm for us, but I am glad that you got it going!
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
Yup, it was a bug.  Good catch.  I have made the changes and it will be corrected in the next build posted.  Thanks!!!
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