How to direct shared path to Microsoft.Data.SQLite Connection String? (UWP)

半世苍凉 提交于 2020-01-04 13:51:26

问题


i'm making 2 UWP apps, and i want to make them share 1 DB.

i'm using Microsoft.Data.SQLite

however, is there any way to share the same DB??

SqliteConnection db = new SqliteConnection("Filename=data.db"));

"Filename=data.db" path was c:\Users(user name)\AppData\Local\Packages(App ID)\LocalState\data.db

However, I know UWP app can only access that c:\Users\ (username)\AppData\Local\Packages(App ID)\LocalState\ folder except shared app data folders.

So, can you tell me how to direct the shared app data folder to Connection String?


回答1:


Are two ways to that:

1) Creates a button to call user action to select the common folder using a Picker to file or folder. Your application stores the access token returned by this explicit authorization and use that in future with no new user interaction.

2) Have a few ways to app get store authorization, but some that needs an enterprise Windows Store association (like Documents Library). I not sure, but for some locations, in the app validation you will be required to justify the needs before to publish your app.

More details in here: https://docs.microsoft.com/en-us/windows/uwp/files/file-access-permissions. See the title "Accessing additional locations".



来源:https://stackoverflow.com/questions/48457786/how-to-direct-shared-path-to-microsoft-data-sqlite-connection-string-uwp

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!