alexwiese / EntityFrameworkCore.OpenEdge

Entity Framework Core provider for Progress OpenEdge
Apache License 2.0
28 stars 19 forks source link

Count() expects Int32. OpenEdge returns Int64 #2

Open alexwiese opened 5 years ago

alexwiese commented 5 years ago

The following throws an exception

   People.Count();

An exception occurred while reading a database value. The expected type was 'System.Int32' but the actual value was of type 'System.Int64'

Workaround for now is to always use LongCount() instead.

BerndSadleder commented 3 years ago

The following throws an exception

   People.Count();

An exception occurred while reading a database value. The expected type was 'System.Int32' but the actual value was of type 'System.Int64'

Workaround for now is to always use LongCount() instead.

FYI: You can use LongCount from Queryable class: https://docs.microsoft.com/en-us/dotnet/api/system.linq.queryable.longcount?view=net-5.0

For me LongCount worked as expected. Sample: var orderItemsCount = (int)orderItemsQuery.LongCount();