[英]Fluent NHibernate: SQLite in-memory database and GUID generated on insert
I'm using SQLite in-memory database for testing purposes. 我正在使用SQLite内存数据库进行测试。 One of the entities has a column map that generate GUID on insert operation.
其中一个实体具有一个列映射,可在插入操作上生成GUID。
this.Map(v => v.Code).Generated.Insert().ReadOnly();
First of all GUID doesn't get generated and every record inserted has an empty GUID. 首先,GUID不会生成,并且插入的每个记录都有一个空的GUID。 Secondly, I cannot retrieve an entity by empty GUID.
其次,我无法通过空GUID检索实体。
this.Session.Query<Entity>().FirstOrDefault(e => e.Code == code);
Everything is fine when I generate GUID on the client side manually prior to saving entity. 当我在保存实体之前手动在客户端生成GUID时,一切都很好。
Anyone has a similar issue? 任何人都有类似的问题?
Thanks 谢谢
How Connection string look like? 连接字符串的外观如何? Maybe "data source=:memory:;BinaryGuid=False" fixes this.
也许“data source =:memory :; BinaryGuid = False”解决了这个问题。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.