ODP.NET EF Core Beta 4 - Difference between two dates — oracle-tech

    Forum Stats

  • 3,716,003 Users
  • 2,242,928 Discussions


Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

ODP.NET EF Core Beta 4 - Difference between two dates

1495799 Member Posts: 8


With ODP.NET EF Core Beta 4, I didn't succeed in getting a difference between two dates.

With this query :

var timeSpan = context.Requests.Select(r => DateTime.Today - r.RequestDate.Date).First();

I got the exception :

System.InvalidOperationException: 'An exception occurred while reading a database value. The expected type was 'System.TimeSpan' but the actual value was of type 'System.Decimal'.'

Inner Exception

InvalidCastException: Unable to cast object of type 'System.Decimal' to type 'System.TimeSpan'.

The type of the RequestDate column is "Date" and here is the Request class :

public class Request


        public Guid Id { get; set; }

public DateTime RequestDate { get; set; }


Sign In or Register to comment.