-1

Where expression:

 filtrationResult = filtrationResult.Where(string.Format("Convert.ToString({0}).Contains(@0)", filter.Field), filter.Value);

filter.Field is name column (Int32)

I get error:

LINQ to Entities does not recognize the method 'System.String ToString(Int32)' method, and this method cannot be translated into a store expression.

How correctly convert?

Mediator
  • 14,951
  • 35
  • 113
  • 191

1 Answers1

0

I'd create a switch statement with all possible values for filter.Field, then use the EF generated properties.

Echilon
  • 10,064
  • 33
  • 131
  • 217