This project is read-only.

How to do a dynamic search?

Sep 28, 2010 at 4:17 PM

Hi all,

i want to have a dynamic search varing the number of parameters to use on search depending on the number of dropdownlists he selected on the user interface..

so i dont want to do this: 

productCollection = ProductCollection.RunSelect(x =>
			x.CategoryId == categoryId && x.Test =="Hi");
I saw this alternative 
CustomerSearch search = new CustomerSearch(Widgetsphere.Core.DataAccess.SearchType.AND);
search.BaseName = "SomeValue";

but I cant find this xxxsearch objects in my nhydrate project...

can anybody help?



Sep 28, 2010 at 9:30 PM


I'm fairly new to nHydrate myself, and searching isn't an area I've played with yet.  Since you didn't mention it, just checking the basics, you did mark the properities that wish to search upon as IsSearchable=True in your model right?  By default they are set to False and I beleive the search object won't get generated.  Just a thought.

Oct 1, 2010 at 4:13 AM

The "CustomerSearch" object is historical implementation. I would suggest useing the LINQ based syntax. You can use the OR syntax to create queries. Look at the following,

string TestVar = "Hi";
ProductCollection productCollection = ProductCollection.RunSelect(x =>
((categoryId != null) || x.CategoryId == categoryId) &&
((TestVar != null) || (x.Test == TestVar));