Recently I had an Advanced Search requirement which had to enable Users to specify a combination of fields to search for and the operator e.g. AND, OR and the type of comparison to do e.g. LIKE, EQUALS. The DataLayer is built upon the Entity Framework and I'm using LINQ to Entities as the query mechanism. So my overriding goal was to keep this Strongly Typed but maintainable as well. Firstly I created a generic SearchInfo object of which there would be one for each field that needed to be included in the search. public class SearchInfo<T> { public Expression<Func<T, object>> PropertySelector { get; set; } public QueryOperator Operator { get; set; } public StringComparer Comparer { get; set; } public string Value { get; set; } } public enum QueryOperator { And = 0, Or = 1 } public enum StringComparer { Equals = 0, StartsWith = 1, EndsWith = 2, Contains = 3 } Now if we just had to deal with the AND operator we could achieve this by con...