0

I am trying to search at the same time with pagination so I pass fieldname and fieldvalue to the url and get this. In the example below, I get the fieldname as 'firstName' and fieldValue as 'Jay'. Then I want to search like this but I get this error, ORM blah blah blah.. I am using LLBLgen as ORM but it seems it's more related to linq. Any ideas?

var sm ={
    FieldName:'firstName',
    FieldValue:'Jay'
}

orderModels = orderModels.Where(x => x + "." + sm.FieldName == sm.FieldValue);

Selim Yildiz
  • 5,254
  • 6
  • 18
  • 28
dumb11
  • 129
  • 1
  • 9

1 Answers1

1

You can use System.Dynamic.Linq package so that you can build query dynamically:

orderModels = orderModels.Where("@0 == @1",sm.FieldName, sm.FieldValue);

See: https://dotnetfiddle.net/cs6MRX

Selim Yildiz
  • 5,254
  • 6
  • 18
  • 28