//using SQLite; //using System; //using System.Collections.Generic; //using System.IO; //using System.Linq.Expressions; //using System.Text; //namespace SlnMesnac.RfidUpload.Common //{ // /// // /// SQLite同步方法帮助类 // /// 作者:追逐时光者 // /// 创建时间:2023年11月30日 // /// // /// // public class SqLiteHelper where T : new() // { // private readonly string _databasePath = Path.Combine(Environment.CurrentDirectory, "db.db"); // private readonly SQLiteConnection _connection; // SQLite连接对象 // /// // /// 构造函数 // /// // public SqLiteHelper() // { // // 创建SQLite连接对象并打开连接 // _connection = new SQLiteConnection(_databasePath); // _connection.CreateTable(); // 如果表不存在,则创建该表[不会创建重复的表] // } // /// // /// 数据插入 // /// // /// 要插入的数据项 // /// // public int Insert(T item) // { // return _connection.Insert(item); // } // /// // /// 数据删除 // /// // /// 要删除的数据的主键ID // /// // public int Delete(int id) // { // return _connection.Delete(id); // } // /// // /// 数据更新 // /// // /// 要更新的数据项 // /// // public int Update(T item) // { // return _connection.Update(item); // } // /// // /// 根据条件查询记录 // /// // /// 查询条件 // /// // public List Query(Expression> predExpr) // { // return _connection.Table().Where(predExpr).ToList(); // } // /// // /// 查询所有数据 // /// // /// // public List QueryAll() // { // return _connection.Table().ToList(); // } // /// // /// 根据条件查询单条记录 // /// // /// 查询条件 // /// // public T QuerySingle(Expression> predExpr) // { // return _connection.Table().Where(predExpr).FirstOrDefault(); // } // } //}