Current Entity Framework Core Documentation gives an example for using SQLite in a Windows 10 / UWP app. The example given declares the db location with optionsBuilder.UseSqlite("Filename=Blogging.db");
The path is equivalent to Windows.Storage.ApplicationData.Current.LocalFolder.Path
This puts the SQLite database in <packagefolder>\LocalState
.
We are exploring using UWP/SQLite for a business application which stores business transactions in a SQLite db. However the folder name LocalState
suggests to me this is the place to store state information, not long term storage of business transactions.
There is another folder <packagefolder>\AppData
. Is this a more appropriate location for our db? If so, how is it accessed in a UWP app? Or is <packagefolder>\LocalState
after all the correct place to put a db that is used for long term storage of business transactions?
Documentation is right. The path for the database (Windows.Storage.ApplicationData.Current.LocalFolder.Path) is correct. Your data will exist as long as the app is installed on the device.
Please see below MSDN article and what is the most important from it:
"local data, which exists as long as the app that created it remains installed"
And one more:
"Local can contain both files (LocalFolder) and settings (LocalSettings) and should be used for any information that is of user value and can’t easily be recreated or downloaded"
ApplicationData.Current.LocalFolder is used to store the information.
https://blogs.windows.com/buildingapps/2016/05/10/getting-started-storing-app-data-locally/#_Local