Found an old thread about the same problem: http://groups.google.com/group/nhusers/browse_thread/thread/cb2d05d9d3e57b6b/f5a1e0586c17dac7 and a JIRA ticket: http://216.121.112.228/browse/NHLQ-8.
On Apr 14, 12:50 pm, Ricardo Peres <[email protected]> wrote: > Hello, > > How can I do a sum using a LINQ query when the query produces no > elements? > > Int32 sum = (from a in session.Query<AnalogicalValue>() select > a.Value).Sum(); > > This fails with a NullReferenceException. The DefaultIfEmpty operator > could probably solve this, but it is not yet implemented. > Does any of you guys have a solution? Shall I add a JIRA issue for > implementing the DefaultIfEmpty operator? > > Thanks! > > RP -- You received this message because you are subscribed to the Google Groups "nhusers" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/nhusers?hl=en.
