-
Notifications
You must be signed in to change notification settings - Fork 3.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix to #5454 - Error when using Where with reference
Problem was for happening for queries with optional navigations like so: context.Orders.Where(o => o.Customer.IsVip) In this case Customer can be nullable, so IsVip can also be nullable. We compensate for this by introducing the following: context.Orders.Where(o => o.Customer != null ? (bool?)o.Customer.IsVip : (bool?)null) However, we didn't convert it back to the original type (users had to introduce those casts themselves). Without the cast, those queries were throwing compile-time exceptions that were not very informative. Fix is to cast back to the original type requested by user: context.Orders.Where(o => (bool)(o.Customer != null ? (bool?)o.Customer.IsVip : (bool?)null)) This still may cause runtime errors if o.Customer is actually null, but those are much more understandable now. Also fixed compilation errors for complex Skip/Take arguments. Those are evaluated on the client for the time being. CR: Andrew, Smit
- Loading branch information
Showing
6 changed files
with
539 additions
and
117 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.