且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

Windows RT与SQLite文件权限问题

更新时间:2023-02-17 13:20:28

对于您在Windows RT上提出的要求,没有好的解决方案。您的分析是正确的:SQLite需要直接访问其数据库文件,并且没有允许直接访问的可共享位置。所有共享文件夹都需要代理访问,SQLite
不使用。如果您不需要本地系统上的数据库,则可以将其放在服务器上并通过REST API访问它。如果应用程序是侧面加载的,您可以在Windows上本地执行相同的操作并启用循环,但这不适用于Windows RT。可能的
hack是将数据库从共享位置复制到ApplicationData以便在应用程序完成后将其复制回共享位置。由于你不会有两个用户同时使用它,这只需要在app
暂停或恢复时交换(我可能会将激活更改交换为更安全)
There is no good solution for what you ask on Windows RT. Your analysis is correct: SQLite requires direct access to its database file, and there are no shareable locations which allow direct access. All shared folders require brokered access, which SQLite doesn't use. If you don't need the database on the local system you could put it on a server and access it via a REST API. If the app is side loaded you could do the same thing locally on Windows and enable loop back, but that won't work on Windows RT. A possible hack would be to copy the database from the shared location to ApplicationData to use then copy it back out to the shared location when the app is done with it. Since you won't have two users using it simultaneously this only needs to be swapped when the app suspends or resumes (I'd probably swap on activation change to be a bit safer)