不正确的字段类型映射 SubSonic 2.2、SQLite 3
我在 SQLite 表中有一个布尔 (BOOL) 类型字段。 在 SubSonic 生成的 DAL 中,它表示为字符串(而不是布尔值)。 这很奇怪。 如何对其进行管理?请帮忙。
I have a boolean (BOOL) type field in the SQLite table.
In the SubSonic generated DAL it is represented as string (instead of bool).
It is weird.
How it can be managed? Please, help.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我可能错了,我只使用了 Subsonic 2.2 和 SQL2008,但我建议查看 Subsonic 的源代码,即
SQLLiteDataProvider.cs
并查看DbType
函数。它似乎可以识别
Boolean
类型,但不能识别Bool
类型,并且当它无法识别您的类型时,默认情况下会求助于String
。Hare 是该函数中的有问题的代码,
我建议对其进行更改,看看它是否有效,然后建议对亚音速小伙子进行更改。
I maybe wrong on this, I have only used Subsonic 2.2 with SQL2008 but I would recommend looking at the source for Subsonic, namely
SQLLiteDataProvider.cs
and reviewing theDbType
function.It seems to recognise the type
Boolean
but notBool
and the default when it does not recognise your type is to resort toString
.Hare is the code in question from that function
I would recommend changing it, seeing if it works and then recommeding the change to the subsonic chaps.
我在 12 月份检查了该提供程序的新版本,修复了几个错误,但据我所知,它没有包含在源下载中——Rob 不使用 sqlite,因此合并和测试不是他的优先事项。我建议查看我的版本,因为它为我解决了几个错误。我有一个更新的版本,它几乎通过了所有单元测试,针对 sqlite 进行了修改,但想知道是否值得上传它。由于数据库锁定错误和核心代码中的 sql server 偏差,测试很难通过——sqlite 具有文件级锁定。单元测试根本没有完全覆盖。
链接到我在 github 上的 SQLiteProvider.cs
我的版本有一个稍微不同的 GetDbType 方法,我发现由于一些脑死亡的原因,我没有将 bool 或 boolean 作为要转换的类型包含在内,所以我将添加它。
I checked in a newer version of the provider in Dec. with several bug fixes, but from what I can tell it's not included in the source download -- Rob doesn't work with sqlite therefore it's not a priority for him to merge and test. I recommend looking my version since it solved several bugs for me. I have an even newer version that passes virtually all of the unit tests, modified for sqlite, but wonder if it's worthwhile uploading it. It was difficult to get the tests to pass due to database locking errors and the sql server bias in the core code -- sqlite has file level locking. The unit tests are not at all complete coverage.
Link to my SQLiteProvider.cs on github
My version has a slightly different GetDbType method, and I see for some brain dead reason I didn't include bool or boolean as a type to convert so I will add that.