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!

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

1495799Jun 5 2019

Hello,

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; }

}

Comments
Post Details
Added on Jun 5 2019
0 comments
249 views