I'm trying to write a dynamic Linq 2 Sql query using Expressions trees but I'm getting a exception telling me that the LessThan and GreaterThan operators are not defined for System.String
and System.String
, which i find odd, is that true? or am I doing something wrong?
Expression<Func<SomeDataContextType, string>> codeSelectorExpresion =
x => x.CodeColumn;
var row = Expression.Parameter(typeof(SomeDataContextType), "row");
var expression =
Expression.GreaterThan(
Expression.Invoke(codeSelectorExpression, row),
Expression.Constant("someString", typeof(string)));
//I'm trying to build something like SomeDataContextType.CodeColumn > "someString"