EntityFunctions support in MySql

前端 未结 2 1874
滥情空心
滥情空心 2021-01-25 23:17

I am getting error while using EntityFunctions.DiffMinutes() with MySQL. Below is my code

return db.DiscoveredDevices.Where(m => EntityFunctions.DiffMinutes((DateTime)m.

2条回答
  •  谎友^
    谎友^ (楼主)
    2021-01-26 00:14

    I think maybe MySQL doesn't implement that Function...

    you can use the other way like this:

        DateTime begin = DateTime.Now - pollTime;
        DateTime end = DateTime.Now + pollTime;
    
        var result = (from s in db.DiscoveredDevices where s.LastPollTime > begin && s.LastPollTime < end && && s.Status == true select s).ToList();
        return result;
    

提交回复
热议问题