I've added the MvvmCross.Sqlite Plugin to my project. Also the SQLite Extension for UWP.
I register the Factory Interface:
Mvx.RegisterType<IMvxSqliteConnectionFactory, WindowsSqliteConnectionFactory>();
And resolve it in my connector class:
private readonly IMvxSqliteConnectionFactory connectionFactory;
public SqliteConnectionCreator(IMvxSqliteConnectionFactory connectionFactory)
{
this.connectionFactory = connectionFactory;
CreateDb();
}
/// <summary>
/// Creates the config and establishe the connection to the sqlite database.
/// </summary>
/// <returns>Established SQLiteConnection.</returns>
public SQLiteConnection GetConnection()
{
return connectionFactory.GetConnection(new SqLiteConfig(OneDriveAuthenticationConstants.DB_NAME, false));
}
private void CreateDb()
{
using (var db = connectionFactory.GetConnection(OneDriveAuthenticationConstants.DB_NAME))
{
db.CreateTable<Account>();
db.CreateTable<Payment>();
db.CreateTable<RecurringPayment>();
db.CreateTable<Category>();
}
}
But as soon as I wanna access either the get Connection or the current platform it throughs an exception:
Exception thrown: 'System.DllNotFoundException' in SQLite.Net.Platform.WinRT.dll
The type of the injected factory is WindowsSqliteConnectionFactory what's correct I think. My projects have a reference to the mvvmplugin and sqlite.net-pcl, sqlite.net.core-pcl,sqlite.net.async-pcl.
Do I have to register something else in mvx? Or how comes that the plattformspecific Factory (WindowsSqliteConnectionFactory) doesn't have a plattform?