本文整理汇总了C#中SQLite.SQLiteConnection.Find方法的典型用法代码示例。如果您正苦于以下问题:C# SQLiteConnection.Find方法的具体用法?C# SQLiteConnection.Find怎么用?C# SQLiteConnection.Find使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SQLite.SQLiteConnection
的用法示例。
在下文中一共展示了SQLiteConnection.Find方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: RunReadTest
async Task RunReadTest()
{
await Task.Factory.StartNew(() =>
{
using (var db = new SQLiteConnection(DatabasePath))
{
db.RunInTransaction(async () => {
var person1 = db.Find<Person>(f => f.FullName.EndsWith("8"));
var person2 = db.Find<Person>(f => f.FullName.EndsWith("3"));
var message = person1 != null && person2 != null
? "Completed!"
: "Did not find both people!";
await dispatcher.RunIdleAsync(a => { ReadResult = message; });
});
}
});
}
示例2: FindCourseSchedule
public static CourseSchedule FindCourseSchedule (decimal classId)
{
CheckAndCreateDatabase ();
string path = Path.Combine (Environment.GetFolderPath (Environment.SpecialFolder.Personal), "CourseSchedule.sqlite");
using (SQLiteConnection db = new SQLiteConnection (path)) {
// create the tables
var classSchedule = db.Find<CourseSchedule> (c => c.ClassId == classId);
// close the connection
db.Close ();
return classSchedule;
}
}
示例3: UpdateDeck
public static void UpdateDeck(DeckViewModel deck)
{
using (var database = new SQLiteConnection(databasePath))
{
var _deck = database.Find<Deck>(d1 => d1.Id.ToString() == deck.UniqueId);
if (_deck != null)
{
_deck.CategoryId = new Guid(deck.Category.UniqueId);
_deck.Title = deck.Title;
_deck.Author = deck.Author;
_deck.Subject = deck.Subject;
_deck.Description = deck.Description ;
_deck.ImagePath = deck.ImagePath;
database.Update(deck);
}
}
}
示例4: UpdateCategory
public static void UpdateCategory(CategoryViewModel category)
{
using (var database = new SQLiteConnection(databasePath))
{
var _category = database.Find<Category>(c1 => c1.Id.ToString() == category.UniqueId);
if (_category != null)
{
_category.Name = category.Name;
database.Update(_category);
}
}
}
示例5: UpdateCard
public static void UpdateCard(CardsViewModel card)
{
using (var database = new SQLiteConnection(databasePath))
{
var _card = database.Find<Card>(c1 => c1.Id.ToString() == card.UniqueId);
if (_card != null)
{
_card.FrontContent = card.FrontContent;
_card.BackContent = card.BackContent;
database.Update(_card);
}
}
}
示例6: DeleteDeck
public static void DeleteDeck(DeckViewModel deck)
{
using (var database = new SQLiteConnection(databasePath))
{
var _deck = database.Find<Deck>(d1 => d1.Id.ToString() == deck.UniqueId);
database.Delete(_deck);
}
}
示例7: DeleteCategory
public static void DeleteCategory(CategoryViewModel category)
{
using (var database = new SQLiteConnection(databasePath))
{
var _category = database.Find<Category>(c1 => c1.Id.ToString() == category.UniqueId);
database.Delete(category);
}
}
示例8: DeleteCard
public static void DeleteCard(CardsViewModel card)
{
using (var database = new SQLiteConnection(databasePath))
{
var _card = database.Find<Card>(c1 => c1.Id.ToString() == card.UniqueId);
database.Delete(_card);
}
}
示例9: MainWindow
public MainWindow(string dbpath)
{
db_ = new SQLiteConnection(dbpath);
db_.CreateTable<Task>();
db_.CreateTable<ProgSettings>();
tasks_ = new ObservableCollection<Task>(db_.Table<Task>().OrderBy(t => t.Order));
settings_ = db_.Find<ProgSettings>(1);
minimise_ = new MinimizeToTray(this, settings_.BallonShown);
settings_.Plugins = new ObservableCollection<Plugin>(new Plugin[] { new PluginCore(settings_), new PluginWords(db_) });
if (settings_ == null)
settings_ = new ProgSettings(db_);
else
settings_.DB = db_;
foreach (Task newItem in tasks_)
{
newItem.PropertyChanged += this.OnItemPropertyChanged;
}
InitializeComponent();
List_Tasks.ItemsSource = tasks_;
Text_Add_Item.Focus();
workArc_.Right = true;
playArc_.Right = false;
workGrey_.Right = false;
playGrey_.Right = true;
customRenders_.Add(workArc_);
customRenders_.Add(playArc_);
customRenders_.Add(workGrey_);
customRenders_.Add(playGrey_);
this.ResetTimer(true, DateTime.Now);
App.Tick += Tick;
Closed += MainWindow_Closed;
mediaPlayer_.Open(new Uri(Environment.CurrentDirectory + "\\bell.mp3"));
mediaPlayer_.Volume = 1.0;
tasks_.CollectionChanged += this.OnCollectionChanged;
}