I have an Nhibernate object that has the properties Firstname and Surname, and I'd like to be able to query on both fields (Firstname + " " + Surname); e.g. If the search term is "John Doe", this will be matched when John and Doe are in seperate fields.
How can I achieve that? Thanks!
So I ended up going with:
.Add(Restrictions.Like(Projections.SqlFunction("concat",
NHibernateUtil.String,
Projections.Property("Firstname"),
Projections.Constant(" "),
Projections.Property("Surname")),
searchString, MatchMode.Anywhere))
Which seems to work as I need it to.
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