//增加 List<Book> books = new List<Book>() { new Book() { BookId = "1", BookName = "将夜", BookLink = "www.baidu.com", DownloadLink = "www.baidu.com" } }; using (var Kindledb = new BookSqliteDb(dbPath)) { int count = Kindledb.InsertAll(books); }
//修改 using (var Kindledb = new BookSqliteDb(dbPath)) { var book = Kindledb.Books.FirstOrDefault(x => x.BookName == "将夜"); if (book != null) { book.BookLink = ""; int count = Kindledb.Update(book); } }
//删除 using (var Kindledb = new BookSqliteDb(dbPath)) { int count = Kindledb.Books.Delete(x => x.BookName == "将夜"); }
//查询 using (var Kindledb = new BookSqliteDb(dbPath)) { var books = Kindledb.Books.Where(x => x.BookName == "将夜").OrderByDescending(x => x.BookId).ToList(); string str = $"{DateTime.Now}, 查到{books.Count}条记录"; }