EntityFunctions support in MySql

前端 未结 2 1844
滥情空心
滥情空心 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-25 23:52

    The DiffMinutes function doesn't exist in MySQL, just create it and will work:

    CREATE FUNCTION `DiffMinutes`(timeValue1 datetime, timevalue2 datetime) RETURNS int(11)
        DETERMINISTIC
    BEGIN
    RETURN TIMESTAMPDIFF(MINUTE, timeValue1, timevalue2);
    END
    

提交回复
热议问题