【发布时间】:2014-01-08 17:15:54
【问题描述】:
我在模型优先模式 (=EDMX) 下使用 System.Data.SQLite 1.0.90 和 VS2013 和 EntityFramework 5。
我创建了一个包含表的新 SQLite 数据库:
CREATE TABLE [..]
[Test1integer] integer,
[Test2int] int,
[Test3smallint] smallint,
[Test4tinyint] tinyint,
[Test5bigint] bigint,
[Test6money] money,
[Test7float] float,
[Test8real] real,
[Test9decimal] decimal,
[Test10numeric18_5] numeric(18,5), [..]
相关部分为Test7float和Test8real。
在执行从数据库更新模型...之后,EDMX 现在包含以下内容:
SSDL:
<Property Name="Test1integer" Type="integer" />
<Property Name="Test2int" Type="int" />
<Property Name="Test3smallint" Type="smallint" />
<Property Name="Test4tinyint" Type="tinyint" />
<Property Name="Test5bigint" Type="integer" />
<Property Name="Test6money" Type="decimal" Precision="53" Scale="0" />
<Property Name="Test7float" Type="real" />
<Property Name="Test8real" Type="real" />
<Property Name="Test9decimal" Type="decimal" Precision="53" Scale="0" />
<Property Name="Test10numeric18_5" Type="decimal" Precision="18" Scale="5" />
相关部分为Test7float和Test8real。
CSDL:
<Property Name="Test1integer" Type="Int64" />
<Property Name="Test2int" Type="Int32" />
<Property Name="Test3smallint" Type="Int16" />
<Property Name="Test4tinyint" Type="Byte" />
<Property Name="Test5bigint" Type="Int64" />
<Property Name="Test6money" Type="Decimal" Precision="53" Scale="0" />
<Property Name="Test7float" Type="Single" />
<Property Name="Test8real" Type="Single" />
<Property Name="Test9decimal" Type="Decimal" Precision="53" Scale="0" />
<Property Name="Test10numeric18_5" Type="Decimal" Precision="18" Scale="5" />
相关部分为Test7float和Test8real。
问题
Test7float 错误地变成了“真实”+“单”——设计师也不允许在此处使用“双”。
SQLite3 文档 (http://www.sqlite.org/datatype3.html) 明确指出“real”是一个 8 字节的 IEEE 浮点数,而“float”只是“real”的同义词——所以在每种情况下都是“Double”(8 字节) 应优先于“Single”(4 字节)。
我做错了什么还是我误解了什么?如果不是:哪里出了问题,我该如何解决?
我应该为此创建一个错误报告吗?
【问题讨论】:
-
看起来你发现了一个错误 :) 你应该看看这个问题是否是由你之前的人报告的,并在适当的时候提交一个新的错误报告。
-
@Luaan 您认为它是 EntityFramework 中的常见错误还是仅适用于 System.Data.SQLite?
-
我不明白为什么这应该与 EntityFramework 本身有关。 EF 确实支持单打和双打,所以它可能是 SQLite“驱动程序”中的一些错误映射。我也会尝试先配置一下,也许有一些兼容性设置之类的。