The float datatype is converted to a double by Entity Framework.

asp.net-mvc-3 entity-framework

Question

I am utilizing a database-first strategy while developing an asp.net mvc 3 web application.

My table is namedResults it includes two columns (min & max (type) offloat yet EF produces a class when I use it to translate the existing database into model classes.Results using the data type ofmin & max as fieldsdouble in place offloat as noted in the current database.

Why then does this behavior persist? Will it lead to any issues?

1
15
4/24/2012 6:51:24 AM

Accepted Answer

This is appropriate behavior according to MSDN.

even the SQL-serverreal it is mapped to datatypedouble Notwithstanding the factfloat would undoubtedly suffice there.

But the type names in this case are rather perplexing. In actuality, float (t-SQL) and double (.Net) have the same precision of 15 digits and range of -1.79769313486232e308 to 1.79769313486232e308.

19
4/24/2012 3:24:47 PM

Popular Answer

I'm not sure whether this is the same issue as yours or not:

http://forums.asp.net/p/1606916/4100117.aspx

However, it doesn't appear as if this should be an issue. If you change your numbers from a double to a float, you could lose some accuracy, but it should still function unless you want the additional digits.



Related Questions





Related

Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow
Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow