本文整理汇总了C#中SQLite.SQLiteAsyncConnection.FindAsync方法的典型用法代码示例。如果您正苦于以下问题:C# SQLiteAsyncConnection.FindAsync方法的具体用法?C# SQLiteAsyncConnection.FindAsync怎么用?C# SQLiteAsyncConnection.FindAsync使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SQLite.SQLiteAsyncConnection
的用法示例。
在下文中一共展示了SQLiteAsyncConnection.FindAsync方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetCategoryName
public async Task<string> GetCategoryName(int categoryId)
{
var name = String.Empty;
var db = new SQLiteAsyncConnection(App.DBPath);
var _category = await db.FindAsync<Category>(c => c.Id == categoryId);
if (_category != null)
name = _category.Name;
return name;
}
示例2: GetByIdsAsync
internal static async Task<IEnumerable<SessionHeaderItem>> GetByIdsAsync(SQLiteAsyncConnection conn, List<int> ids)
{
var results = new List<SessionHeaderItem>();
foreach (var id in ids)
{
var session = await conn.FindAsync<SessionHeaderItem>(id);
if (session != null)
results.Add(session);
}
// return...
return results;
}
示例3: GetCategory
public async Task<CategoryViewModel> GetCategory(int categoryId)
{
var category = new CategoryViewModel();
var db = new SQLiteAsyncConnection(App.DBPath);
var _category = await db.FindAsync<Category>(c => c.Id == categoryId);
if (_category == null)
return null;
category.Id = _category.Id;
category.Name = _category.Name;
return category;
}
示例4: Button_Click_1
private async void Button_Click_1(object sender, RoutedEventArgs e)
{
string baza = comboboxusunzbazy.SelectedValue.ToString();
string slowko = comboboxslowkodousuniecia.SelectedValue.ToString();
string[] tablica = slowko.Split(new[] {'.'});
if (baza.Equals("eFiszki"))
{
baza = "AppData";
}
var path = Windows.Storage.ApplicationData.Current.LocalFolder.Path + @"\" + baza + ".sqlite";
var db = new SQLiteAsyncConnection(path);
var maxid = 0;
List<UserDefaultDataBase> result = await db.QueryAsync<UserDefaultDataBase>("Select max(id) as Id From UserDefaultDataBase");
foreach (var item in result)
{
maxid = item.Id;
}
int indeksdousuniecia = Convert.ToInt32(tablica[0]);
var all = await db.QueryAsync<UserDefaultDataBase>("Select * From UserDefaultDataBase");
var del = await db.FindAsync<UserDefaultDataBase>(u => u.Id == indeksdousuniecia);
await db.DeleteAsync(del);
//Debug.WriteLine("maksymalny indeks: " + maxid + ", indeks do usuniecia:" + indeksdousuniecia);
//if (maxid != indeksdousuniecia)
//{
// List<UserDefaultDataBase> updateid = await db.QueryAsync<UserDefaultDataBase>("Select * From UserDefaultDataBase Where Id = ?", new object[] { maxid });
// var update = updateid.First();
// update.Id += 100;
// update.SlowkoEn = "toz to dziala";
// await db.UpdateAsync(update);
// Debug.WriteLine("Update indeksu:" + maxid + " na " + indeksdousuniecia);
// //foreach (var i in updateid)
// //{
// // Debug.WriteLine(i.Id);
// //}
// //await db.QueryAsync<UserDefaultDataBase>("Update UserDefaultDataBase set id= ? where id=?", new object[] {maxid, indeksdousuniecia });
// //foreach (var i in updateid)
// //{
// // var update = updateid.First();
// // update.Id = indeksdousuniecia;
// // await db.UpdateAsync(update);
// //}
//}
comboboxslowkodousuniecia.Items.Clear();
setcomboslowko();
}
示例5: GetBackContent
public async Task<string> GetBackContent(int cardId)
{
string backContent = String.Empty;
var db = new SQLiteAsyncConnection(App.DBPath);
var _card = await db.FindAsync<Card>(c1 => c1.Id == cardId);
if (_card != null)
backContent = _card.BackContent;
return backContent;
}
示例6: GetCard
public async Task<CardViewModel> GetCard(int cardId)
{
var card = new CardViewModel();
var db = new SQLiteAsyncConnection(App.DBPath);
var _card = await db.FindAsync<Card>(c1 => c1.Id == cardId);
if (_card == null)
return null;
card.Id = _card.Id;
card.FrontContent = _card.FrontContent;
card.BackContent = _card.BackContent;
card.DeckId = _card.DeckId;
return card;
}
示例7: GetDeckDescription
public async Task<string> GetDeckDescription(int deckId)
{
var description = String.Empty;
var db = new SQLiteAsyncConnection(App.DBPath);
var _deck = await db.FindAsync<Deck>(d1 => d1.Id == deckId);
if (_deck != null)
{
description = _deck.Description;
}
return description;
}
示例8: GetDeckTitle
public async Task<string> GetDeckTitle(int deckId)
{
var title = String.Empty;
var db = new SQLiteAsyncConnection(App.DBPath);
var _deck = await db.FindAsync<Deck>(d1 => d1.Id == deckId);
if (_deck != null)
{
title = _deck.Title;
}
return title;
}
示例9: GetDeck
public async Task<DeckViewModel> GetDeck(int deckId)
{
var deck = new DeckViewModel();
var db = new SQLiteAsyncConnection(App.DBPath);
var _deck = await db.FindAsync<Deck>(d1 => d1.Id == deckId);
if (_deck == null)
return null;
deck.Id = _deck.Id;
deck.Title = _deck.Title;
deck.Author = _deck.Author;
deck.Subject = _deck.Subject;
deck.Description = _deck.Description;
deck.CategoryId = _deck.CategoryId;
return deck;
}