Cannot Sum Double?
Hi,
with the new ef core 2.1 I get errors when I try to sum a nullable doube (double?). E.g.:
var allArrivedTransports = await _context.Transport.Select(t => new
{
TotalChargeableWeightPerTransport =
t.TransportItems.Sum(ti => ti.ChargeableWeight))
})
.ToListAsync();
ChargeableWeight is a nullable doube. One Transport has one to many TransportItems. I get:
System.InvalidOperationException: No coercion operator is defined between types 'System.Threading.Tasks.Task1[System.Double]' and 'System.Nullable1[System.Double]'.
at System.Linq.Expressions.Expression.GetUserDefinedCoercionOrThrow(ExpressionType coercionType, Expression expression, Type convertToType)
at System.Linq.Expressions.Expression.Convert(Expression expression, Type type, MethodInfo method)
at System.Linq.Expressions.Expression.Convert(Expression expression, Type type)
at Microsoft.EntityFrameworkCore.Query.Internal.RelationalResultOperatorHandler.HandleSum(HandlerContext handlerContext)
All worked well with 2.0.
kind regards, thanks for the greate work you are doing
This almost certainly an issue in EF Core rather than the Npgsql provider, can you please move this issue to http://github.com/aspnet/EntityFrameworkCore? In the unlikely case this turns out to be related to Npgsql we'll reopen.