Automapper map decimal, float, double

41 views
Skip to first unread message

turcu.98...@gmail.com

unread,
Dec 8, 2019, 10:58:52 AM12/8/19
to AutoMapper-users
Hi!

I am trying to map some fields that are double, and each time when I use automaper to map them the values are rounded. Is this an issue or a normal behavior?

For example I have this two objects:

public class Position 
{
   public double (or decimal, float) Latitude {get; private set;}
}

public class PositionModel
{
   public double (or decimal, float) Latitude {get; set;}
}

When I map from PositionModel to Position, and the Latitude from an object of type PositionModel has the value 47.4334, in the object that results, of type Position, the value of Latitude is 48.

I tried to use also decimal or float, but I have the same behavior.

If I didn't give enough details, please let me know. Thanks! 

turcu.98...@gmail.com

unread,
Dec 8, 2019, 11:00:46 AM12/8/19
to AutoMapper-users
PS: I am using AutoMapper 9.0.0
Reply all
Reply to author
Forward
0 new messages