private static QueryCondition BuildQueryCondition <T>(string postFilter) { var postFilterParts = postFilter.Split(new[] { "=", "==", "!=", "<>", ">", "<", ">=", "<=" }, 2, StringSplitOptions.RemoveEmptyEntries); if (postFilterParts.Length != 2) { return(null); } var propertyName = postFilterParts[0]; var constraintValue = postFilterParts[1]; var stringOperator = postFilter.Substring(propertyName.Length, postFilter.Length - propertyName.Length - constraintValue.Length); Operator binaryOperator; try { binaryOperator = OperatorFactory.FromString(stringOperator); } catch (ArgumentException) { // unsupported operators are ignored return(null); } var type = typeof(T); var property = type.GetProperty(propertyName, BindingFlags.Public | BindingFlags.Instance); if (property == null) { return(null); } var queryCondition = new QueryCondition() { Term = new OperatorTerm() { Operator = binaryOperator }, ConstraintValue = constraintValue, Property = new PropertyModel() { Alias = propertyName, Name = propertyName, Type = property.PropertyType.Name } }; return(queryCondition); }