Reputation: 4758
With a grouped query, when building by result I get different results
This works in LinqPad but not in code
Name = s.Key.FirstName + " " + s.Key.LastName ?? "Unknown User"
This works in Code but not in LinqPad
Name = s.Key.FirstName != null ? s.Key.LastName + " " + s.Key.LastName : "Unknown User"
This works in both
Name = String.IsNullOrEmpty(s.Key.FirstName) ? "Unknown User" : s.Key.FirstName + " " + s.Key.LastName,
Can anyone explain why
Upvotes: 0
Views: 157
Reputation: 18746
LinqPad uses Linq2Sql by default.
The are certainly differences in the LINQ that works between EF
and Linq2Sql
. That is almost certainly what you are running into.
LINQ acts differently based on what provider actually runs the composed query. There are many more than this but it's a start:
You can write your own LINQ providers
Although if you tell Linqpad to add an EF library it will consume one you create:
Upvotes: 1