我正在使用MvvmCross创建Android,WPF和Windows Phone 8/8.1应用程序。我已经在WPF和Android应用程序中正常使用SQLite。MvvmCross - Windows Phone 8 + SQLite - 无法打开数据库文件
使用Windows Phone应用程序时,我在调用SQLite数据库文件的Create()时遇到了问题。
第一次调用时,创建和打开工作就好了,但是当第二次调用create()时,它总是失败。
代码:
ISQLiteConnection db = factory.Create("filename.sql");
db.Close();
错误:
"Could not open database file: filename.sql (CannotOpen)"
堆栈:
at SQLite.SQLiteConnection..ctor(String databasePath, Boolean storeDateTimeAsTicks)
at Cirrious.MvvmCross.Plugins.Sqlite.WindowsPhone.MvxWindowsPhoneSQLiteConnectionFactory.Create(String address)
at MvvmCrossPOC.Core.Services.MetadataService.OpenDatabase()
我跟着这篇文章,并用类似的步骤等,并增加了MvvmCross SQLite的插件(V3 .5 - 安装包MvvmCross.HotTuna.Plugin.SQLite),但错误依然存在。
WP8 SQLite error: The specified module could not be found
就如何推进有什么想法?
代码示例:
public MetadataService(ISQLiteConnectionFactory SQLiteConnectionFactory)
{
factory = SQLiteConnectionFactory;
}
public List<Platform> GetPlatformCollection()
{
db = factory.Create(METADATA_REPO_NAME);
try
{
return db.Table<Platform>().ToList();
}
finally
{
db.Close();
}
}