public ObservableCollection<AppUser> AppUser { get; set; }
public AppUserDbConnect(string dbPath)
{
_database = new SQLiteAsyncConnection(dbPath);
_database.CreateTableAsync<AppUser>().Wait();
this.AppUser = new ObservableCollection<AppUser>(_database.Table<AppUser>());
}
此代码创建数据库连接,然后基于AppUser
模型创建表。我试图存储最后一行的结果,但我面临以下错误:
CS1503参数1:无法转换
Dialler1.DatabaseConnection.AsyncTableQuery<AppUser>
来System.Collections.Generic.IEnumerable<AppUser>
答案 0 :(得分:0)
为db.Table<T>()
this.AppUser = new ObservableCollection<AppUser>(_database.Table<AppUser>().ToList());