large integer filter support


When I filter for a large number, such as 5049903980094673, the query submitted sets the last digit to 0 so the number becomes 5049903980094670. I tried using long and decimal mappings with same results. If I set the entity mapping to string then the value takes on decimal notation 5.04990398009467E+15 which doesn't return proper results.

A large integer like 5049903980094673 needs to be submitted to the database without value changes or scientific notation. Using TGH connected to Oracle 11g.

Closed Dec 15, 2012 at 12:10 PM by Luis_Fernando


Luis_Fernando wrote Oct 25, 2012 at 4:04 PM

Do you know what would be the best matching column type to build a test in SQLServer 2012?

Noyabronok wrote Oct 25, 2012 at 5:14 PM

It's a NUMBER in Oracle, and according to this page http://msdn.microsoft.com/en-us/library/ms151817.aspx it maps to FLOAT, but I don't think that's a good idea. This the the values are all whole numbers I would choose NUMERIC(38)

Thanks Luis.

Luis_Fernando wrote Oct 30, 2012 at 10:17 PM

The problem is not in the database.

Internally TGH uses "Convert.ChangeType(obj, objType)" to resolve values ​​coming from the user interface, "obj" is the value that comes from Telerik.GridCommand as a double (and we have no control over it), so in this case we are converting from double to decimal or long, when the conversion occurs, the value ends up losing precision in large numbers. Some important details about .NET's numbers precision on this response from Jon Skeet: http://stackoverflow.com/a/8284292/401576

I'm still after a less invasive solution, but until then I have a suggestion for you; ValueResolver to the rescue!

public class DecimalValueResolver : IValueResolver
public object Resolve(ResultContext source)
    var s = ((double)source.Value).ToString("R");
    var d = Decimal.Parse(s, NumberStyles.Currency);
    return d;

This will preserve precision in large numbers, hope it can help you for now, tell me if you have a better idea.

Luis_Fernando wrote Oct 30, 2012 at 11:59 PM

I think I'm approaching a coherent solution after reading this answer (http://stackoverflow.com/a/611564/401576) and this docs (http://msdn.microsoft.com/en-us/library/dwhawy9k.aspx?ppud=4).

Luis_Fernando wrote Oct 31, 2012 at 12:09 AM

I just push a new commit with a possible solution;


Nugets and binaries tomorrow.

Luis_Fernando wrote Nov 18, 2012 at 8:57 PM

It's solved? Can I close the issue?

Noyabronok wrote Nov 21, 2012 at 2:13 PM

Looks like you did it! Case closed.