Does anyone have advice about how to tackle a multiple field search such as searching a product database by like a combination of category, description, price, a date field etc...from a CSLA perspective? Is it a mere matter of having the data access method from the object be a TSQL string as opposed to using a stored procedure? I've always cringed when it comes to putting that type of search in a stored procedure.
And in the same vain, is there any example out there of using efficient paging methods with CSLA?
Cheers!
Webjedi
This has been discussed many times.
Try searching the forum for old messages.
The approach I take is to create a special Root BO to store all the values on the Search screen. Say there are 10 things you can search by. Then the screen has 10 rows and the first control in each row is a checkbox. When the user fills in a value for a given row the checkbox is checked. Based on this the BO will "know" which rows have been checked and can build an appropriate WHERE clause filter using a method called GetFilter. The BO also can rules like make sure at least on checkbox is checked, etc.
This search screen BO is passed to a ROC as the sole criteria (as a Parameter to the factory Fetch method.)
Once the DataPortal_Fetch method is invoked, the criteria is extracted and you call GteFilter on the Root BO that was passed in. Then you can add it to your SQL Statement to retrieve the data.
Joe
Copyright (c) Marimer LLC