I have a helper method used a lot in my queries. Sample below:
public static bool HelpMe()
=> dbContext.MyTable.Any(entity => entity.SomeBoolean)
The problem is when I use it in another query, I get another that EF cannot translate it.
In short, this won't work:
dbContext.OtherTable.Where(entity => HelpMe() == entity.Value)
but this will:
dbContext.OtherTable.Where(entity => dbContext.MyTable.Any(entity => someCondition(entity)) == entity.Value)
Obviously the 2nd is bad because It's not as readable and requires changing the code in multiple places.
I've read about IMethodCallTranslator and am wondering how it can be used to get EF core to convert the HelpMe method just as it normally would.