public int Insert <T>(string dbPath, T entity) { using (var db = SqliteCon.CreateConnection(dbPath)) { return(db.Insert(entity)); } }
public int Execute(string query, params object[] args) { using (var db = SqliteCon.CreateConnection(mainDbPath)) { return(db.Execute(query, args)); } }
public int Update <T>(string dbPath, T entity) { using (var db = SqliteCon.CreateConnection(dbPath)) { return(db.Update(entity)); } }
public List <T> GetEntityList <T>(string dbPath, string query, params object[] args) where T : new() { using (var db = SqliteCon.CreateConnection(dbPath)) { return(db.Query <T>(query, args)); } }
public int DeleteEntity(string dbPath, object objectToDelete) { using (var db = SqliteCon.CreateConnection(dbPath)) { return(db.Delete(objectToDelete)); } }
public int ExecuteScalar(string dbPath, string query, params object[] args) { using (var db = SqliteCon.CreateConnection(dbPath)) { return(db.ExecuteScalar <int>(query, args)); } }
public T GetEntity <T>(string DbPath, string query, params object[] args) where T : new() { T t = default(T); using (var db = SqliteCon.CreateConnection(DbPath)) { t = db.Query <T>(query, args).FirstOrDefault(); } return(t); }
public void ExecuteWithTransaction(List <string> sqls) { using (var db = SqliteCon.CreateConnection(mainDbPath)) { try { db.BeginTransaction(); foreach (var sql in sqls) { db.Execute(sql); } db.Commit(); } catch (System.Exception) { db.Rollback(); } } }