protected virtual void InitPageCount() { using (DbCommandWrapped wrapped = this.DbHelper.CreateDbCommandWrapped(this.CreateSqlCountCommand(), this.Condition.Parameters)) { this.RecordCount = wrapped.ExecuteScalar().As <int>(); } }
protected List <T> ExecuteDbObjectList <T>(DbCommandWrapped command) { using (command) { return(command.ExecuteDbObjectList <T>()); } }
protected DataSet ExecuteDataSet(DbCommandWrapped command) { DataSet dataset = new DataSet(); this.FillDataSet(dataset, command); return(dataset); }
public virtual List <T> ReadAsDbObjectList <T>() { List <T> list; try { this.BeginExecute(); this.InitPageCount(); int startIndex = (this.PageNumber - 1) * this.PageSize; if (this.RecordCount > 0) { StringBuilder builder = new StringBuilder(this.Select.Length + 40); builder.Append(this.Select); builder.Append(this.Condition.ToString()); using (DbCommandWrapped wrapped = this.DbHelper.CreateDbCommandWrapped(builder.ToString(), this.Condition.Parameters)) { return(wrapped.ExecuteDbObjectList <T>(startIndex, this.PageSize)); } } list = new List <T>(); } finally { this.EndExecute(); } return(list); }
protected long ExecuteIdentity(DbCommandWrapped command) { using (command) { return(this.ExecuteIdentity(command.Command, command.KeepConnection)); } }
public override DataTable ReadAsDataTable() { DataTable table; try { this.BeginExecute(); this.InitPageCount(); if (base.RecordCount > 0) { string queryCommand = this.GetQueryCommand(); using (DbCommandWrapped wrapped = base.DbHelper.CreateDbCommandWrapped(queryCommand.ToString(), base.Condition.Parameters)) { DataSet ds = new DataSet(); using (DbDataAdapter adapter = base.DbHelper.CreateDbDataAdapter(wrapped.Command)) { wrapped.FillDataSet(adapter, ds); return((ds.Tables.Count > 0) ? ds.Tables[0] : null); } } } table = null; } finally { this.EndExecute(); } return(table); }
protected object ExecuteScalar(DbCommandWrapped command) { using (command) { DateTime now = DateTime.Now; object obj2 = command.ExecuteScalar(); this.ProcessSlowCommandLog(command.Command, now, DateTime.Now); return(obj2); } }
protected virtual DbDataReader ExecuteReader(DbCommandWrapped command) { using (command) { DateTime now = DateTime.Now; DbDataReader reader = command.ExecuteReader(); this.ProcessSlowCommandLog(command.Command, now, DateTime.Now); return(reader); } }
protected int ExecuteNonQuery(DbCommandWrapped command) { using (command) { DateTime now = DateTime.Now; int num = command.ExecuteNonQuery(); this.ProcessSlowCommandLog(command.Command, now, DateTime.Now); return(num); } }
protected T ExecuteDbObject <T>(DbCommandWrapped command) { using (DbDataReader reader = this.ExecuteReader(command)) { if (reader.Read()) { return(reader.ToObject <T>()); } return(default(T)); } }
protected void FillDataSet(DataSet dataset, DbCommandWrapped command) { using (command) { DateTime now = DateTime.Now; using (DbDataAdapter adapter = this.CreateDbDataAdapter(command.Command)) { command.FillDataSet(adapter, dataset); } this.ProcessSlowCommandLog(command.Command, now, DateTime.Now); } }
public override List <T> ReadAsDbObjectList <T>() { List <T> list; try { this.BeginExecute(); this.InitPageCount(); if (base.RecordCount > 0) { string queryCommand = this.GetQueryCommand(); using (DbCommandWrapped wrapped = base.DbHelper.CreateDbCommandWrapped(queryCommand.ToString(), base.Condition.Parameters)) { return(wrapped.ExecuteDbObjectList <T>()); } } list = new List <T>(); } finally { this.EndExecute(); } return(list); }
private DbCommandWrapped CreateDbCommandWrapped(DbCommand command) { return(DbCommandWrapped.Create(command, this.KeepConnection)); }