public int Update(string table, string primarykey, string condition, object rowdata, IDbTransaction transaction) { if (primarykey == null) { throw new ArgumentNullException("primarykey"); } if (table == null) { throw new ArgumentNullException("table"); } if (rowdata == null) { throw new ArgumentNullException("rowdata"); } if (table.Length <= 0) { throw new ArgumentException("table"); } if (primarykey.Length <= 0) { throw new ArgumentException("primarykey"); } using (IDbCommand cmd = DatabaseAccessAuxiliary.CreateUpdate(rowdata, table, primarykey, condition, DatabaseAccessAdapter)) { cmd.Transaction = transaction; return(ExecuteNonQuery(cmd)); } }
public IDbConnection Get(IRelational relational, Func <IDbConnection> newConnection) { if (relational == null) { throw new ArgumentNullException("relational"); } if (newConnection == null) { throw new ArgumentNullException("newConnection"); } else { this._newConnection = newConnection; } IDbConnection connection = null; if (!this._connections.TryGetValue(relational, out connection)) { connection = newConnection(); if (!DatabaseAccessAuxiliary.TryConnectConnection(connection)) { DatabaseAccessAuxiliary.CloseConnection(connection); connection = null; } else { relational.Disposed += this._closeRelationalEvt; this._connections.Add(relational, connection); } } return(connection); }
public IDbTransaction CreateTransaction() { IDbConnection connection = GetConnection(); DatabaseAccessAuxiliary.ConnectConnection(connection); return(connection.BeginTransaction()); }
public DataTable Select(IDbCommand cmd) { if (cmd == null) { throw new ArgumentNullException("cmd"); } return(DatabaseAccessAuxiliary.FillDataTable(cmd, DatabaseAccessAdapter)); }
public IDataReader ExecuteReader(IDbCommand cmd) { if (cmd == null) { throw new ArgumentNullException("cmd"); } return(DatabaseAccessAuxiliary.ExecuteReader(cmd, DatabaseAccessAdapter)); }
public int ExecuteNonQuery(IDbCommand cmd) { if (cmd == null) { throw new ArgumentNullException("cmd"); } return(DatabaseAccessAuxiliary.ExecuteNonQuery(cmd, DatabaseAccessAdapter)); }
public DataTable Select(string procedure, object parameter) { if (parameter == null) { throw new ArgumentNullException("parameter"); } return(this.Select(procedure, DatabaseAccessAuxiliary.GetParameters(parameter, DatabaseAccessAdapter))); }
public virtual IDbConnection Remove(IRelational relational) { if (relational == null) { throw new ArgumentNullException("relational"); } IDbConnection connection = null; if (this._connections.TryGetValue(relational, out connection)) { relational.Disposed -= this._closeRelationalEvt; this._connections.Remove(relational); } DatabaseAccessAuxiliary.CloseConnection(connection); return(connection); }
public int Insert(string table, object rowdata, IDbTransaction transaction) { if (rowdata == null) { throw new ArgumentNullException("rowdata"); } if (table == null) { throw new ArgumentNullException("table"); } if (table.Length <= 0) { throw new ArgumentException("table"); } using (IDbCommand cmd = DatabaseAccessAuxiliary.CreateInsert(rowdata, table, DatabaseAccessAdapter)) { cmd.Transaction = transaction; return(ExecuteNonQuery(cmd)); } }
public override IDbDataParameter[] GetParameters(string procedure) { return(DatabaseAccessAuxiliary.GetParameters <SqlConnection, SqlCommand>(procedure, this, (cmd) => SqlCommandBuilder. DeriveParameters(cmd))); }