Skip to Main Content

ODP.NET

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

DbFunctions/EF.Functions

neil-scalesMay 16 2023

I'm trying to convert an old .NET Framework/EF query into .NET Core/EFCore.

Old code:

var results = context.Appointments  
    .Any(x => DbFunctions.AddYears(x.ChildGeneral.DateOfBirth,12) \<= DbFunctions.TruncateTime(x.BookingDate));

Basically, get all the appointments where the child over 12 years, on the date of the booking.

EF Core uses EF.Functions, but it appears that the methods are supplied by the driver, and the only ones available for Oracle are

  • Collate
  • Like
  • Random

The documentation for MS-SQL give other methods like DateDiffYears, but these aren't available for Oracle.

How can I translate this query to EF core?

Comments
Post Details
Added on May 16 2023
1 comment
2,081 views