在我的数据库中:
databasePath = GetPath(docsFolder);
connection = new SQLiteAsyncConnection(databasePath);
connection.CreateTableAsync<BO>().Wait();
数据库路径是 /data/user/0/com.companyname.AppName/files/fn.db3 (包名称仅在此处过滤)
但是在创建表格时会发生这种情况: 未处理的异常: System.AggregateException:发生了一个或多个错误。
在BO中,我已经删除了DateTime: 目前只有string和int是应用的类型。
public class BO
{
[PrimaryKey, AutoIncrement]
public int ID { get; set; }
public string From { get; set; }
public string To { get; set; }
public string Note { get; set; }
}
的NuGet:
<package id="sqlite-net-pcl" version="1.4.118" targetFramework="portable45-net45+win8+wpa81" />
<package id="SQLitePCLRaw.bundle_green" version="1.1.5" targetFramework="portable45-net45+win8+wpa81" />
<package id="SQLitePCLRaw.core" version="1.1.5" targetFramework="portable45-net45+win8+wpa81" />
编辑:
在AggregateException
中只有TypeInitializationException
,这在创建表时会出现。但是SQLite.SQLiteConnection
在调试时被称为关于TypeInitializationException
的TypeName。
代码中明确定义了SQLiteAsyncConnection connection
。
是否缺少创建db文件的权限?
答案 0 :(得分:0)
Android项目中缺少2个包。
SQLitePCLRaw.lib.e_sqlite3.android
SQLitePCLRaw.provider.e_sqlite3.android