EF CORE“dotnet ef dbcontext 支架”定义数据类型

发布于 2025-01-20 16:45:48 字数 237 浏览 0 评论 0原文

我已经搜索网络已经有一段时间了,但是找不到我想要的东西。

基本上,当我针对我的sqlite db运行上述代码时,它会生成所有类等,但是它没有呈现布尔值等,而是选择将它们作为字节[] []创建,并且所有浮点数都以双倍的形式创建。

我不想要这个,因为在对付数学时,双打往往会很差,并且会创造不正确的值。

因此,基本上我想知道的是,是否有一种方法来定义类型的映射。因此,数据库中的所有“真实”都是像Bool一样的十进制和位?

I've been searching the web for a while, but can't find what I'm looking for.

Basically when I run the aforementioned code against my Sqlite DB, it generates all the classes etc, but instead of rendering booleans etc, it chooses to create them as byte[] and all floating point numbers come through as doubles.

I don't want this, as doubles tend to do poorly when doing math against them, and can create incorrect values.

So basically what I want to know, is, is there a way to define the mapping of types. So all "REAL" in the database are created as Decimal and BIT as bool?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文