Entity Framework Bug, extra decimal places
I think I have found a bug in EF5, but I want to verify that this isn't
some weird behavior there is a known fix for (nothing on Google or Bing as
far as I can see).
I'm doing a select on a database value that is 0.06 in a field that is
decimal(18,2). I ran the query I expected EF to generate and got .06 back,
I took the sql profiler query that ef ran an also got .06 back. In my code
however, I got .0675. I checked the EDMX field and it has a matching
precision/scale of 18,2.
My data is "1 version with 4 sets" so my query does a where clause on the
version number and then gets 4 rows back, but only row 3 gets the weird
value. Row 1, 2, and 4 are .03, .04, and .12 and they return as such, but
row 3 is .06 but returns as .0675.
Last thing that could be useful is the EF proxies are the only part that
is wrong. If I select the EF Proxies, that is when this pops up, but if I
do the select into my viewmodel the correct value is returned.
_entities.Sets.Where(x => x.VersionID == versionID) // ---> returns bad value
_entities.Sets.Where(x => x.VersionID == versionID).Select(x => new VM {
Rate = x.Rate}) // ---> returns correctly
Any ideas on this behavior?
No comments:
Post a Comment