BusinessBase as Criteria #3707
-
We need our need criteria object to verify it's properties before we send it to the main Business object to get data from the DB. Do we have an example some where? Kind Regards |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 7 replies
-
This is exactly how we handle complex criteria. We use BusinessBase for criteria classes used for business object lookup as well as parameters for inquiries, reports, and workflows. They aren't very complex, mainly validation of required criteria, "exists" checks, ranges (from/to), min/max of numeric values, etc. None of these criteria classes have persistence. |
Beta Was this translation helpful? Give feedback.
-
I love the answers here. The only thing I'll add is that, in current CSLA, you'll need a create operation method so you can initially create the object. [Create]
private void Create() {} |
Beta Was this translation helpful? Give feedback.
The pattern you describe is correct. I'm not sure how the example you cited relates to this topic. Here's a partial example of a criteria class we use when adding serial numbers to an inventory item. Note that there is no data portal functionality of this class. It is used strictly to validate user input. The WinForms UI has a
PropertyChanged
event handler that checks validitiy of the critieria. Leading to a line likeAddSerialBindingSource.DataSource = DataPortal.Create<ItemSerial>(critieria);
The criteria parameter is the instance of this class.