Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Data type issue on Enumerable.Sum(TSource) method #8324

Closed
saf-itpro opened this issue Apr 28, 2017 · 2 comments
Closed

Data type issue on Enumerable.Sum(TSource) method #8324

saf-itpro opened this issue Apr 28, 2017 · 2 comments

Comments

@saf-itpro
Copy link

Environment: EF-Core 1.1, VS2015, Windows 10 (updated from Windows 7)

I'm getting the following error on LINQ Query shown below:
Unable to cast object of type 'System.Double' to type 'System.Nullable1[System.Single]'`

LINQ:
var totalFreight = (from cust in db.Customers join ord in db.Orders on cust.ordID equals ord.OrdID select ord.Freight).Sum();

NOTES:

  1. I'm trying to follow these MSDN examples: 1 and 2

  2. I've verified that Freight column in Orders table is of type float?. In VS2015, I've hover over ord.Freight in the above query to confirm the type of Freight column - that's is showing as float?

  3. I've tried changing var to float? and double? and decimal?. But still the EXACT SAME error message as shown above.

@smitpatel
Copy link
Contributor

@maumar

@maumar
Copy link
Contributor

maumar commented Apr 28, 2017

dupe of #7136 which will be fixed in the next release (2.0.0-preview1)

@maumar maumar closed this as completed Apr 28, 2017
@ajcvickers ajcvickers reopened this Oct 16, 2022
@ajcvickers ajcvickers closed this as not planned Won't fix, can't repro, duplicate, stale Oct 16, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants