This is a follow-up on question on [Passing a comparison function as a parameter into Entity Framework](https://stackoverflow.com/questions/26893229/passing-a-comparison-function-as-a-parameter-into-entity-framework).

I would like to pass a comparison function and a value into a search function that queries Entity Framework. The comparison function has to operate on different properties depending on the value. E.g., my data is

```
class DataItem
{
  [Key]
  public int ID { get; set; }
  public bool Active { get; set; }
  public string Prop1 { get; set; }
  public string Prop2 { get; set; }
}

```

and I need a context method

```
public List<DataItem> SearchValue(Func<string, string, bool> op, string value)
{
  if (value.Length < 10)
    return DataItem.Where(di => di.Active && op(di.Prop1, value)).ToList();
  else
    return DataItem.Where(di => di.Active && op(di.Prop2, value)).ToList();
}

```

that I can then call like 

```
List<DataItem> list = context.SearchValue((s1, s2) => s1 == s2, "A");

```

where I also need different comparison functions (all canonical).

Program compiles alright, but on running I get a "The LINQ expression node type 'Invoke' is not supported in LINQ to Entities." error.

Loading the DataItems into memory is not an option since I'll have around a billion of them. That's why I'm looking for a server-side solution. All the operations I'm using are canonical, so they can be translated into SQL queries. My question is just: how can I pass them as parameters?