【发布时间】:2018-08-26 05:15:15
【问题描述】:
我提交这个问题有两个原因:我在使用在Mono 下运行的DBreeze 数据库引擎时遇到了困难,但我找到了一种解决方法,它可能有助于其他人解决这个确切的问题(我发布了解决方法作为答案),如果其他人知道更好的解决方案,我将不胜感激。
问题是DBreeze 在 Windows 上正常工作,但在带有 Mono 的 Linux 上,在引擎初始化和第一次插入后它会引发以下异常:
Unhandled Exception: DBreeze.Exceptions.DBreezeException: Getting table "@utt2"
from the schema failed! ---> DBreeze.Exceptions.TableNotOperableException:
DBreeze.Scheme ---> DBreeze.Exceptions.DBreezeException: Rollback of the table
"DBreeze.Scheme" failed! ---> DBreeze.Exceptions.DBreezeException: Restore
rollback file "./DB/_DBreezeSchema" failed! --->
System.EntryPointNotFoundException: FlushFileBuffers
问题出在DBreeze/Storage/FSR.cs文件中,因为它试图调用
[System.Runtime.InteropServices.DllImport("kernel32.dll", ExactSpelling = true, SetLastError = true)]
private static extern bool FlushFileBuffers(IntPtr hFile);
但这在 Mono 中不受支持。
问题是:如何正确刷新文件缓冲区/调用等价于kernel32.dll的FlushFileBuffers()将缓冲区内容写入Mono下的磁盘?
【问题讨论】:
-
为了适应本网站的格式,请将其编辑为问题并将答案添加为下面的答案。这个问题不应该自己回答
-
谢谢你的建议,我已经分开了。