We are using the following to generate a search query (using NHibernate).
GetAll(x => x.Username.ToUpper().Contains(SEARCH)).ToList();
Is it possible to do a search (Contains) for multiple properties, something like ...
GetAll(x => x.Username.ToUpper().Contains(SEARCH)
&& x => x.Firstname.ToUpper().Contains(SEARCH)
&& x => x.Lastname.ToUpper().Contains(SEARCH)).ToList();
Using C#
GetAll(x => x.Username.ToUpper().Contains(SEARCH)
&& x.Firstname.ToUpper().Contains(SEARCH)
&& x.Lastname.ToUpper().Contains(SEARCH)).ToList();
I'd imagine you'd want to do a search on OR though:
GetAll(x => x.Username.ToUpper().Contains(SEARCH)
|| x.Firstname.ToUpper().Contains(SEARCH)
|| x.Lastname.ToUpper().Contains(SEARCH)).ToList();
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With