Details in the title, code is below. How do I populate the model values from the SQlite response?
//Current line returns the below response
var test2 = await Database.QueryAsync<User>("SELECT * FROM User");
Model
public class User
{
public int Id { get; set; }
public string FirstName { get; set; }
public string LastName { get; set; }
public string Username { get; set; }
public string Token { get; set; }
}
CodePudding user response:
SQLite.NET will return a list of User
objects, you don't need to do anything to populate them
var query = await Database.Table<User>();
var results = await query.ToListAsync();
foreach (var user in results)
{
// user is a User object
}