I asked a question at Use a NaturalSortComparer in a LINQ Where Clause and now I have a more complex version.
That query assumed a simple query like ProductCode > 'U5' and using a NaturalComparer in the Where clause:
var comparer = new NaturalComparer();
Table1.AsEnumerable().Where(t=>
comparer.Compare(t.ProductString, "U5") >= 0);
The code below for a simple known example, but in reality the filter is nested and has combinations of And/OR operands and is unknown until runtime. I want to pass into a dynamic LINQ query as a string: The data is on SQL Server db using LINQ to Entities.
Example:
var queryString= "((ProductCode > 'U5' Or TagString LIKE '%k') and Date < Now)
Or (MessageString = 'text' And Date < yesterday) OR SomeOtherString = '100'
or PriorityString <= '100X' or SomeInt =15";
// Call the constructor with the specified query and the ObjectContext.
ObjectQuery<Product> productQuery =
new ObjectQuery<Product>(queryString, context);
How would I process the string fields using the NaturalComparer, and any other field type to be processed as normal?