Recently I encountered a situation similar to
https://www.llblgen.com/tinyforum/Messages.aspx?ThreadID=16966
What I did is explicitly passing in a no use property of the entity to trick it(linq expression parser?) not to treat the function as in memory
Some code snippet of mine:
public static Object GeomFromGeojson(string geojson, Object o[This is My Trick])
{
return null;
}
this.Add(new FunctionMapping(typeof(GeomFuncs), "GeomFromGeojson", 2, "ST_GeomFromGeoJSON({0})", "", ""));
linqMetaData.SomeEntity.Where(c => GeomFuncs.STContains(c.Area, GeomFuncs.GeomFromGeojson("{\"type\":\"Point\",\"coordinates\":[-87.22217, 30.44195]}", c.Id[This is My Trick])))
Without the tricking second parameter, the whole GeomFromGeojson will be passed in as null, which is result of the function definition, resulting unexpected result.
So, my question is, except this workaround of mine, is there a better way to make it work?