Reputation: 1911
Everyone.
I am using SqLite in Xamarin Forms. For that I am using SqLite - PCL nuget. Now the problem is, It works fine in Android. But in UWP I can't Access database file. I am using Common code for both Platforms. It is as below :
database = new SQLiteConnection(Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.Personal), "mydb.db"));
database.CreateTable<Item>();
The error I am getting in UWP app only.
Thank You.
Upvotes: 1
Views: 209
Reputation: 89204
the docs contain clear instructions on how to do this in UWP
using Windows.Storage;
...
[assembly: Dependency(typeof(FileHelper))]
namespace Todo.UWP
{
public class FileHelper : IFileHelper
{
public string GetLocalFilePath(string filename)
{
return Path.Combine(ApplicationData.Current.LocalFolder.Path, filename);
}
}
}
Upvotes: 2