oracle / oracle/dotnet-db-samples
Performing sum on date subtraction (TimeSpan) not working (.NET 7)
Nobody has claimed this yet.
- Dominant language
- C#
- Stars
- 434
- Forks
- 191
- Avg merge
- 1d 15h
- Merged PRs (30d)
- 1
Description
Example:

This will generate a "could not be translated" exception.
I find it strange that simple datetime operations like this is not at all working even in .NET 7. As it's something that is probably quite a common thing to do.
Sure one could always do the operation in .NET after the query has ran. But that is not a very performant solution, if you're fetching a lot of rows.
Also I'm wondering why oracle has chosen to not including ANY of the EF.Functions that Microsoft does for SQL server? If you would've, then this simple datetime handling would've probably worked without issue.

I really think microsoft did a major blunder in not enforcing all providers to provide some default EF.Functions as it makes becoming DB agnostic A LOT more complicated than it needs to be.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
The issue provides a .NET 7 example only through screenshots and names no source file or test. Start by reproducing the date-subtraction sum query against the Oracle provider, then identify where translation fails. Done means the query performs the sum without a "could not be translated" exception.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- csharp
- Domain
- backend, databases
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 35/100