Cannot make a dynamic LINQ query work
I am using the following dynamic query in LinqPad with PredicateBuilder enabled. You can enable this by pressing F4 and then checking the check-box in bottom right of the popup.
The query throws this error when I try to execute it: Cannot implicitly convert type 'string' to 'System.Linq.Expressions.Expression>'
Question: What is the problem with my dynamic LINQ query below? I had C#Expressions selected from LinqPad drop-down.
I am trying to dynamically build a where condition for a LINQ query. Query is based on standard Northwind database.
The query throws this error when I try to execute it: Cannot implicitly convert type 'string' to 'System.Linq.Expressions.Expression>'
Question: What is the problem with my dynamic LINQ query below? I had C#Expressions selected from LinqPad drop-down.
I am trying to dynamically build a where condition for a LINQ query. Query is based on standard Northwind database.
<code>int? orderParam = 100;
string orderOperator = ">=";
string linqFilter = "";
linqFilter= String.Format("{0} {1} {2}", "o.OrderID", orderOperator, orderParam);
linqFilter.Dump();
var predicate = PredicateBuilder.False<Orders>();
predicate = (linqFilter);
var dynamicResult = from o in Orders.Where(predicate) select o;
dynamicResult.Dump
Comments