实体框架的float数据类型映射到双 [英] Entity Framework maps the float datatype into double

查看:121
本文介绍了实体框架的float数据类型映射到双的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用的数据库,第一个办法一个asp.net MVC 3 web应用程序。

I am working on an asp.net mvc 3 web application using database-first approach.

我有一个名为结果包含两列(分和放大器;最大)的表型的浮动,但是当我使用实体框架来映射现有的数据库为模型类,那么EF创建一个类结果与数据在分钟和放大器的类型;最大字段,双击而不是浮动作为exsiting数据库中指定

I have a table called Results that contains two columns (min & max) of type float, but when I use the Entity Framework to map the existing database into model classes, then EF creates a class Results with the data type of the min & max fields as double instead of float as specified in the exsiting database.

那么,为什么这种行为发生?它会造成什么问题吗?

So why is this behaviour happening? Will it cause any problems?

推荐答案

这是正常的行为,按的 MSDN

This is normal behaviour, as per MSDN.

即使SQL服务器的真正数据类型映射到双击,虽然浮动肯定是够了那里。

Even SQL-server's real datatype is mapped to double, even though float would definitely be enough there.

但类型名称很混乱这里。事实上 浮动(T-SQL)是一样的 双击(.NET ):15位的precision并积极1.79769313486232e308一系列负面1.79769313486232e308

But the type names are very confusing here. In fact float (t-SQL) is the same as double (.Net): a precision of 15 digits and a range of negative 1.79769313486232e308 to positive 1.79769313486232e308.

这篇关于实体框架的float数据类型映射到双的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆