The message is clear enough. The expression passed to your Where call is later translated into SQL using EF. EF has no idea how to translate a property indexer to a JToken , so it fails.
You can get around this by getting a value outside the expression. Linking this in your lambda will result in a "constant" in the generated expression.
var deviceKey = o["deviceKey"].ToString(); var disp = db.Dispositivos .Where(p => p.ClaveDispositivo == deviceKey);
Alternatively, you'd better call disp.Any() (or replace Where with Any ) if that's all you want to check. Calling ToList will cause all data to be retrieved and materialized only so that it can be ignored.
source share