Im using Fluent NHibernate as my ORM and NH Profiler is throwing me this sql query when I execute it
INSERT INTO [Location]
(Name,
Lat,
Lon)
VALUES ('my address' /* @p0 */,
-58.37538459999996 /* @p1 */,
-34.5969468 /* @p2 */);
which is absolutly correct by the way. This is the design of my Location table:
[Id] [int] IDENTITY(1,1) NOT NULL,
[Name] [varchar](255) NULL,
[Lat] [decimal](23, 20) NULL,
[Lon] [decimal](23, 20) NULL,
But when I see the inserted data in sqlserver management studio, I can see it inserted
-58.37538000000000000000 instead of -58.37538459999996000000 and
-34.59694000000000000000 instead of -34.59694680000000000000.
When I execute this insert query manually, it inserts the values correctly (the 14 decimals for Lat Column) , but if nhibernate does this, it only inserts 5 decimals.
Any ideas???
The issue comes with the default
precision
andscale
. NHibernate defaultdecimal
representation isdecimal (28,5)
, so that's why the final INSERT statement contains only 5 decimal places. XML mappingfluent:
Now the INSERT statement will be
decimal (23,20)
.