How to build a custom expression for an advanced search screen
问题 I am building an advanced search screen and am using nHibernate to query the DB. I have already built my DataAccess layer and have built a generic method which works great - I pass in an expression to be used as a predicate and passes back a collection of an object that matches the predicate: public object LoadByPredicate<T>(Expression<Func<T, bool>> predicate) where T : class Example usage is: var items = _query.LoadByPredicate<StaticTypes>(x => x.StaticName == type) as List<StaticTypes>;