Reputation: 21312
I am sure this is something really simple, but I am going bonkers trying to figure out why.
I have the following code:
string condition = string.Format("{0}.Contains({1})", column, value);
var query = DataContext.MyTable.Where(condition);
The strange thing that I am getting is an error saying:
Argument cannot convert from string to 'System.Linq.Expressions.Expression<System.Func<Context.MyTable, bool>>'
I thought that you could pass in a string to the where clause without a problem such as indicated in this post:
Any thoughts on what I am missing? Perhaps an invalid namespace (I have System.Linq)?
Upvotes: 1
Views: 2679
Reputation: 126547
You need to:
using System.Linq.Dynamic
Upvotes: 3