EF to SQLite 中的guid类型如何实现?

qizbigbird 2014-12-23 09:20:24
guid可以插入到sqlite中,但是读不出来:
could not be set to a 'System.String' value. You must set this property to a non-null value of type 'System.Guid'.
我在sqlite里设置guid字段的类型是text,blob也报类似的错误。
...全文
239 2 打赏 收藏 转发到动态 举报
写回复
用AI写文章
2 条回复
切换为时间正序
请发表友善的回复…
发表回复
q107770540 2014-12-23
  • 打赏
  • 举报
回复
读取的时候用 .AsEnumerable()转化一下数据再进行select操作:
db.YourTable.Where(...)..AsEnumerable().Select(...)
qizbigbird 2014-12-23
  • 打赏
  • 举报
回复
引用 1 楼 q107770540 的回复:
读取的时候用 .AsEnumerable()转化一下数据再进行select操作:
db.YourTable.Where(...)..AsEnumerable().Select(...)
不行:
IEnumerable<User> users = db.Users.AsEnumerable().Select(s => s);
User user = users.First();
The type of the key field 'ID' is expected to be 'System.Guid', but the value provided is actually of type 'System.String'.

110,539

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术 C#
社区管理员
  • C#
  • Web++
  • by_封爱
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

让您成为最强悍的C#开发者

试试用AI创作助手写篇文章吧