Does anyone have any code sampels that do not rely on OnPropertyChanged for checking the business rules and passing errors back the the UI (2 tier application)
right now the code uses a handler and activates a callback action to acomplish this but it only works sporadically. ie :
Protected Overrides Sub OnCollectionChanged(e As System.Collections.Specialized.NotifyCollectionChangedEventArgs)
thanks in advance
Do you want the validation error to appear as part of the parent object that contains the collection, or the child object(s) in the collection?
Either way, you should consider overriding OnChildChanged in the parent object that contains the collection, and that's where you should either trigger the rules in the parent, or trigger the rules in the child that was changed.
I never got an email to know that you had answered thsi question along with the fact that I got pulled into another project and funally just got back to working on this problem.
You are correct in that I do want the error to to be part of the parent object that contains the collection. I don't know if this will work though since there are no postbacks with the way the code we have is wirtten its constits of alot of jquery and ajax elements.
I discuss this in the Using CSLA 4 ebook series.
The short answer is that in the parent object you override OnChildChanged, and that way you know that a child object has changed so you can execute appropriate rules in the parent object by calling BusinessRules.CheckRules.
I don't know how this will work with ajax callbacks. If the state available on the web/app server isn't current, clearly you can't run any rules at that location. So you'll have to implement your solution such that the web/app server has the current state at the point you expect the rules to run.
Ok you basically confirmed what I thought
We found a work arround using SQL to create a specific error message , I then catch that error and display the specific error based on the content in the message. A bit ugly but it works well in this scenario. The only thing I dislike is I could not grab error message constants from my business rule withoute fully instantiaing it Argh!
thanks for the fast feedback
Copyright (c) Marimer LLC