Problems with BeforeDelete and AfterDelete events


Author
Message
choyt
choyt
StrataFrame User (132 reputation)StrataFrame User (132 reputation)StrataFrame User (132 reputation)StrataFrame User (132 reputation)StrataFrame User (132 reputation)StrataFrame User (132 reputation)StrataFrame User (132 reputation)StrataFrame User (132 reputation)StrataFrame User (132 reputation)
Group: Forum Members
Posts: 78, Visits: 246
Hi All

I am having problems with the BeforeDelete and AfterDelete events not firing. I have tried setting it up both of the ways shown below.

Private Sub MemberFamily_AfterDelete(ByVal e As MicroFour.StrataFrame.Business.AfterDeleteEventArgs) Handles Me.AfterDelete

       Call Me.SetIncomplete()

End Sub

and as

AddHandler Me.CheckRulesOnCurrentRow, AddressOf MemberFamily_AfterDelete (in the constructor)

Private Sub MemberFamily_AfterDelete(ByVal e As MicroFour.StrataFrame.Business.AfterDeleteEventArgs)

       Call Me.SetIncomplete()

End Sub

When I put a breakbpoint on Call Me.SetIncomplete() it is never reached.

I have quite a bit of code in other events (specifically CheckRulesOnCurrentRow, SetDefaultValues and the AfterSave which is setup with an inline Handles Me.AfterSave) which works just fine. I am deleting the records using DeleteByPrimaryKey(FamilyMemberID) and the records are deleting successfully.

Replies
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
Yeah,  the DeleteByPrimaryKey goes straight to "smoking" the records. Smile  You probably want to use the DeleteCurrentRow method if you do not want the records to be immediately deleted from the database.  The DeletePrimaryKey method does not require that the PK in which you are trying to delete is within the BO itself, whereas the DeleteCurrentRow method is going to delete a record with the BO.
StrataFrame Team
S
StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)
Group: StrataFrame Developers
Posts: 3K, Visits: 2.5K
As for the transactions, if you retrieve the record into the business object and then use the DeleteCurrentRow(True) and Save() combination, then the deletes will happen on whatever transaction the Save() uses.
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