You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am currently using EF Core 2.1 with Postgresql. I have some Entities that use DatetimeOffset. When I try to do a difference on two DateTimeOffset the operation is happening on client side. I tried looking into DbFunctions for performing DateTimeOffset diff on client side but can't seem to find the methods in DbFunctions.
The following code is what I am trying to accomplish
Thanks for the reply. Will this be supported in the future? Is there any other way I can do Diffs on DateTimeOffset on the server side besides raw sql?
@SamHuo213 We did some investigation into data handling by different database engines and came to the conclusion that DateDiff is a mostly SQL Server construct. Other providers are more able to translate the regular DateTime methods, which is more natural anyway. See #10656 for more details.
This means that it is up to the PostgreSQL provider to determine appropriate translations for DateTime operations, preferably based on translations of normal BCL methods, but potentially also with function mappings where appropriate. You should file an issue on https://github.com/npgsql/Npgsql.EntityFrameworkCore.PostgreSQL
Then you better call it SQLServer.Functions not EF.Functions , and even better call the framework SqlSeverFramework not EntityFramework. That is a shame!
Hi,
I am currently using EF Core 2.1 with Postgresql. I have some Entities that use DatetimeOffset. When I try to do a difference on two DateTimeOffset the operation is happening on client side. I tried looking into DbFunctions for performing DateTimeOffset diff on client side but can't seem to find the methods in DbFunctions.
The following code is what I am trying to accomplish
context.Entity
.Where(x => EF.Functions.DateDiffSeconds(x.ExpirationTime, DateTimeOffset.UtcNow))
.ToList();
The text was updated successfully, but these errors were encountered: