General information
Category:
The Mere Mortals .NET Framework
Title:
Event handling in business objects
Hi again.
I am just starting out with MM and have a question on event handling. I have read through the documentation, but still am not sure how to handle this.
My database has some tables with FK constraints. When deleting a record may violate a FK constraint in another table (can't delete the parent when there are children) I use a stored procedure to check to see if the constraint will be violated. I do this so that I don't generate a cryptic (to the user) SQL exception. I call this pre delete SP from within the HookPreDeleteEntity method and everything works fine.
However, I would like to be able to raise an event to the user interface to tell the user why the delete failed. Unlike the SaveEntity() method, the DeleteEntity() method returns a bool instead of a RulesBroken enum. Can I use the OnStateChange() method to raise the event I need, or do I need to add another event to my BusinessObject class? Or am I missing something more fundamental?
Thanks in advance.
Tim Holgerson
Next
Reply
View the map of this thread
View the map of this thread starting from this message only
View all messages of this thread
View all messages of this thread starting from this message only