public virtual bool Delet <M>(int id) where M : class, new() { string cmtext = query.Delete <M>(id.ToString()); using CommanderBase commander = DBContext.CreateCommander(); return(commander.NonQuery(cmtext)); }
public virtual (List <M>, bool) GetAll <M>(params string[] column) where M : class, new() { string cmtext = query.GetAll <M>(column); using (CommanderBase commander = DBContext.CreateCommander()) return(commander.Reader <M>(cmtext)); }
public virtual bool Update <M>(M t, int id) where M : class, new() { string cmtext = query.Update <M>(id.ToString()); using (CommanderBase commander = DBContext.CreateCommander()) return(commander.NonQuery(cmtext, commander.SetParametrs(t))); }
public virtual List <T> GetAll(params string[] column) { string cmtext = query.GetAll(column); using (CommanderBase commander = DBContext.CreateCommander()) return(commander.Reader <T>(cmtext)); }
public virtual bool Delet(int id) { string cmtext = query.Delete(id.ToString()); using (CommanderBase commander = DBContext.CreateCommander()) return(commander.NonQuery(cmtext)); }
public virtual List <T> getFromTo(int from, int to) { string cmtext = query.getFromTo(from, to); using (CommanderBase commander = DBContext.CreateCommander()) return(commander.Reader <T>(cmtext)); }
public virtual (M, bool) GetWithConditionFist <M>(string condition, params string[] selectColumn) where M : class, new() { string cmtext = query.Condition <M>(condition, selectColumn); using (CommanderBase commander = DBContext.CreateCommander()) { return(commander.ReaderFist <M>(cmtext)); } }
public virtual List <T> getFromToWithSrc(int from, int to, string srcClm, string srcValue) { string cmtext = query.getFromToWithSrc(from, to, srcClm); using (CommanderBase commander = DBContext.CreateCommander()) return(commander.Reader <T>(cmtext, new List <DbParameter> { commander.SetParametr(srcClm, srcValue) })); }
public virtual List <T> GetByColumName(string columName, object value) { string cmtext = query.GetByColumName(columName); using (CommanderBase commander = DBContext.CreateCommander()) return(commander.Reader <T>(cmtext, new List <DbParameter>() { commander.SetParametr(columName, value) })); }
public virtual (M, bool) GetByColumNameFist <M>(string columName, object value, params string[] selectColumn) where M : class, new() { string cmtext = query.GetByColumName <M>(columName, selectColumn); using (CommanderBase commander = DBContext.CreateCommander()) { return(commander.ReaderFist <M>(cmtext, new List <DbParameter>() { commander.SetParametr(columName, value) })); } }
public virtual bool Update <M>(string[] columns, object[] values, int id) where M : class, new() { string cmtext = query.Update <M>(id.ToString(), columns); var p = new List <DbParameter>(); using (CommanderBase commander = DBContext.CreateCommander()) { for (int i = 0; i < columns.Length; i++) { p.Add(commander.SetParametr(columns[i], values[i])); } return(commander.NonQuery(cmtext, p)); } }
public virtual int RowCount() { string cmtext = query.RowCount(); using (CommanderBase commander = DBContext.CreateCommander()) { var o = commander.Scaller(cmtext); if (o != null) { return(Convert.ToInt32(o)); } else { return(0); } } }
public virtual int Insert(T t) { string cmtext = query.Insert(); using (CommanderBase commander = DBContext.CreateCommander()) { var p = commander.SetParametrs(t); var id = commander.Scaller(cmtext, p); if (id != null) { return(Convert.ToInt32(id)); } else { return(0); } } }
public CommanderBase CreateCommander() { CommanderBase commander = null;; switch (ORMConfig.DbType) { case DbType.MSSQL: commander = new SqlCommander(); break; case DbType.Oracle: commander = new OracleCommander(); break; default: break; } return(commander); }
public virtual (int, bool) Insert <M>(M t, DbTransaction transaction = null) where M : class, new() { string cmtext = query.Insert <M>(); using (CommanderBase commander = DBContext.CreateCommander()) { var p = commander.SetParametrs(t); var(id, b) = commander.Scaller(cmtext, parameters: p, transaction: transaction); if (b && id != null) { return(Convert.ToInt32(id), b); } else { return(0, b); } } }
public virtual int RowCountWithSrc(string srcClm, string srcValue) { string cmtext = query.RowCountWithSrc(srcClm); using (CommanderBase commander = DBContext.CreateCommander()) { var o = commander.Scaller(cmtext, new List <DbParameter>() { commander.SetParametr(srcClm, srcValue) }); if (o != null) { return(Convert.ToInt32(o)); } else { return(0); } } }