SQLitePCL.raw
SQLitePCL.raw copied to clipboard
UWP: create database outside of app local data store
I'm hoping you might be able to help. I am using sqlite-net-pcl which in turn uses SQLitePCL.raw. I am trying to store my sqlite database in UWP outside of the app local data store. I want to store it in a location that the user has picked and that I have stored in the StorageApplicationPermissions.FutureAccessList.
My understanding from this article is that the low-level sqlite implementation uses CreateFile2 which fails outside of the app local data store. (the code project article was written for WP8 so not sure whether it is still valid)
Any ideas on how I could accomplish this?
Referencing aspnet/Microsoft.Data.Sqlite#287
I don't think I have any easy answers here. I don't have experience with using UWP in this way.
From the article, it kinda looks like people try to workaround UWP's rules here with a sqlite VFS. But I wonder how "official" that is. Would a UWP app fail store validation if it did this? But this is just me thinking out loud.
I write files outside of the app local data store all the time so I don't think creating the database there would be an UWP validation issue. You have to let the user pick the folder and then add it to the FutureAccessList and then both standard .NET file I/O or StorageFolder/StorageFile stuff works fine. Does your library provide access to the methods to wire in a new VFS? I tried putting one together using the code project article as a guide but my UWP C++ and C# interop skills are lacking!
No, SQLitePCL.raw does not expose APIs to allow a VFS to be written in C#.
@ericsink since I am using sqlite-net-pcl and SQLitePCL.raw, any ideas how I would wire in a new VFS if I ever figure out how to build one?
This is pretty much the last straw for me in using UWP. MS doesn't seem to care that you get to a certain point in development and then there's simply no way to accomplish what you're trying to do because of an overly-aggressive sandbox.
overly-aggressive sandbox
Empathetic 👍. UWP has been death by a thousand paper cuts since its inception in Windows 8. Who blocks connections to localhost, and who requires a dialog box to interact with the local file system!
It’s a shame because UWP is almost a really good framework but seems to suffer from neglect, lack of follow-through, and paranoia :)
And out of that neglect, Uno was born.
Interesting. Thanks!
For all that's great about UWP and there is a lot, it's just one aggravation after another. Opening a SQLite database from somewhere other than isolated storage as a prime example. "Well, you can copy the database into isolated storage, then copy it back out when you're done.".
Without some change UWP will continue to flounder because people who want to get apps out on time with the functionality requested will choose other platforms.
Is it possible to use API Redirection
to solve this issue? There is an example for c++, but I couldn’t figure out how to use this with EntityFrameworkCore
.
I am new to С# and have little understanding of how the call chain goes. Perhaps you have ideas on how to use this.
Closing old/stale issue.