dotnet / dotnet/efcore

Introduce EF.Functions.DateDiffBig* overloads returning long

Open
#32,278 1 comment 0 reactions 0 assignees View on GitHub
area-query customer-reported
Dominant language
C#
Stars
14.8k
Forks
3.4k
PR merge metrics
PR metrics pending

Description

What problem are you trying to solve?

```
Microsoft.Data.SqlClient.SqlException (0x80131904): The datediff function resulted in an overflow. The number of dateparts separating two date/time instances is too large. Try to use datediff with a less precise datepart.
```

```cs
db.Bars.Where(x =>
EF.Functions.DateDiffMinute(x.PeriodStart, x.PeriodEnd) > validForMinutes
)
```

I can't use a less precise datepart so the solution is to use `DATEDIFF_BIG`.

```cs
db.Bars.Where(x =>
EF.Functions.DateDiffMinuteLong(x.PeriodStart, x.PeriodEnd) > validForMinutes
)
```

Am I missing something?

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.