Hi Mike-
This makes sense to me. I have been using Codebook for the last year or so and the problem is that the busobj displays messages when errors occur. I like the idea of having the busobj store error info and then allowing the client to retrieve the error message. This is exactly the type of approach I was looking for.
Rob
>Hi Rob,
>
>I've taken a slightly different approach to this that also works quite well. Basically, the business object has a protected cErrorMessage property and SetErrorMessage and GetErrorMessage methods. When a method fails, like save, the calling object calls the business object's GetErrorMessage method, which just returns the error message as a string. GetErrorMessage basically stores cErrorMessage to a variable, clears the property and returns the variable. SetErrorMessage accepts a string, which is added to the existing error message, which is nice in case multiple business rules were violated. It's actually a little more complicated than this because GetErrorMessage actually polls member objects for errors as well, but you get the idea.
Précédent
Suivant
Répondre
Voir le fil de ce thread
Voir le fil de ce thread à partir de ce message seulement
Voir tous les messages de ce thread
Voir tous les messages de ce thread à partir de ce message seulement