I have an exiting database with couple of float/double fields, I chose to use EF4.1 for my DAL/ORM, but I am having problems when reading/saving data to his type of fields. There is no model, just using model builder to configure the entities.
First there was a rounding problem, I think typical of floating point math, so because all of the precision were already set as 2 decimals, I switched to using decimal type on the c# (EF) side, but now when I am trying to get an entity, I get an exception saying I am in trouble.
The 'xxxkg' property on 'YYY' could not be set to a 'Double' value. You must set this property to a non-null value of type 'Decimal'.
xxxkg is float null on the database, and the value is 10 in the specific case, and in the class it is
public decimal? xxxkg { get; set; }
The question is how to deal with dbtype float/double variables with EF4 (poco)?