I am having a problem converting this query via an expression tree:
WageConstIn => Convert.ToString(WageConstIn.Serialno).StartsWith("2800")
This is my expression tree:
var searchTextExp = LinqExpression.Constant("2800");
var parameterExp = LinqExpression.Parameter(typeof(WageConstInEntity), "WageConstIn");
var propertyExp = LinqExpression.Property(parameterExp, "Serialno");
var convertExpr = LinqExpression.Parameter(typeof(Convert), "Convert");
var toStringExp = LinqExpression.Call(convertExpr, "ToString", new[] { typeof(decimal) }, new[] { propertyExp });
var startsWithExp = LinqExpression.Call(toStringExp, "StartsWith", null, new[] { searchTextExp });
I am getting the following error:
"No method 'ToString' on type 'System.Convert' is compatible with the supplied arguments"