public void TestAsyncTableElementAtAsync() { SQLiteAsyncConnection conn = GetConnection(); conn.CreateTableAsync <Customer>().Wait(); conn.ExecuteAsync("delete from customer").Wait(); // create... for (int index = 0; index < 10; index++) { Customer customer = CreateCustomer(); customer.FirstName = index.ToString(); conn.InsertAsync(customer).Wait(); } // query... AsyncTableQuery <Customer> query = conn.Table <Customer>().OrderBy(v => v.FirstName); Task <Customer> task = query.ElementAtAsync(7); task.Wait(); Customer loaded = task.Result; // check... Assert.AreEqual("7", loaded.FirstName); }
public async Task <List <Currency> > ReadChoosen(int length) { List <ChoosenCurrenciesTable> choosenCurrencies = await database.Table <ChoosenCurrenciesTable>().ToListAsync(); AsyncTableQuery <Currency> query = database.Table <Currency>(); List <Currency> currencies = new List <Currency>(); for (int i = 0; i < length; i++) { int index = choosenCurrencies[i].CurrencyId - 1; currencies.Add(await query.ElementAtAsync(index)); } return(currencies); }