Description
Environment
Attachments
- 10 Apr 2012, 11:38 AM
is related to
Activity
Oskar Berggren March 6, 2013 at 9:09 AM
@Anish Patel The question is not how to implement it, but if it's a good idea or not. I closed the bug with the reasoning that we should follow the semantics of L2SQL and L2EF. Now I think there are rumors that the behavior on L2EF might be changed to return 0 when there are no matching rows. If that's true maybe we should reopen.
Really, "var sum = myQuery.Sum(x => (int?)x.Prop) ?? 0" is a decent workaround for now.
Anish Patel March 6, 2013 at 8:52 AM
how about the option to use the ?? coalesce, which could be converted to ISNULL() is SQL?
Oskar Berggren March 5, 2013 at 6:19 PM
@Anish Patel Please read at least my comments from october and november 2012 above.
Anish Patel March 5, 2013 at 5:30 PM
why won't this be fixed?
Oskar Berggren November 11, 2012 at 9:39 PM
Due to now clean and easy way to solve this robustly, the current behavior, which matches L2SQL and L2EF will remain for now. Closing as won't fix.
Linq query fails when trying to sum a decimal: session.Query<Payment>().Where(x => x.Customer.Id == 4).Sum(x => x.Amount);
.NET version 4, SQL server 2008