oracle / oracle/dotnet-db-samples

Performing sum on date subtraction (TimeSpan) not working (.NET 7)

Open
#271 3 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
C#
Stars
434
Forks
191
Avg merge
1d 15h
Merged PRs (30d)
1

Description

Example:

image

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.

image

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

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.