DbFunctions throwing error System.Nullable on DiffMinutes()
I have a query that runs just fine until I call:
System.Data.Entity.DbFunctions.DiffMinutes(visitclock, v.START_TIME) > 0
Then I get:
'NotSupportedException: Method 'System.Nullable`1[System.Int32] DiffMinutes(System.Nullable`1[System.DateTime], System.Nullable`1[System.DateTime])' has no supported translation to SQL.'
The field is of DateTime Not Nullable, there is another field of type DateTime in another table (vv.CheckInTIme) that is Nullable, but I don't see why this would or should be an issue. If I run the query without this call it executes just fine. So why am I getting this error?
I have the NuGet EntityFramework of the latest version attached to the query. Need help asap to get a project moving that I've been fighting for a couple of days.
Thanks in advance.
System.Data.Entity.DbFunctions.DiffMinutes(visitclock, v.START_TIME) > 0
Then I get:
'NotSupportedException: Method 'System.Nullable`1[System.Int32] DiffMinutes(System.Nullable`1[System.DateTime], System.Nullable`1[System.DateTime])' has no supported translation to SQL.'
The field is of DateTime Not Nullable, there is another field of type DateTime in another table (vv.CheckInTIme) that is Nullable, but I don't see why this would or should be an issue. If I run the query without this call it executes just fine. So why am I getting this error?
I have the NuGet EntityFramework of the latest version attached to the query. Need help asap to get a project moving that I've been fighting for a couple of days.
Thanks in advance.
Comments
http://stackoverflow.com/a/332513/1105812 SQL-wise a comparison with a constant will perform better than a DATEDIFF() calculation on each row, so you could try something like: