I have created a MedicalLabResult table on Sql server 2008 that have a Result field with datatype of Float.
but when i have mapped my database using Entity Framework , the DBContext template automatically assign a Double data type to my Result field on the model class.
so if i try to write something as:-
float result = MedicalLabResult.Single().Result;
Then visual studio will raise an error that it can not implicitly convert float to double ,so i had to modify the above to :-
double result = MedicalLabResult.Single().Result;
But since the datatype for the Result field in the database is Float,, so will it be risky to converte Float to Double in regards to losing any data?
BR
Entity framework designer did everything right. Sql server
Floatdatatype is actually 64 bit double precision floating point number, its equivalent in CLR isSystem.Double. If you want to store single precision floating point then you have to userealin sql. It is mapped to CLRSystem.Single.For further references of SQL Server and CLR datatypes you can go here