EntityFrameworkCore.OpenEdge icon indicating copy to clipboard operation
EntityFrameworkCore.OpenEdge copied to clipboard

Count() expects Int32. OpenEdge returns Int64

Open alexwiese opened this issue 7 years ago • 1 comments

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.

alexwiese avatar Dec 03 '18 11:12 alexwiese

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();

BerndSadleder avatar May 31 '21 18:05 BerndSadleder