public List <T> ToList <T>(DBBuilder dbBuilder, string sortExpression = null) where T : new() { if (sortExpression == null) { return(this.Do(dbBuilder, connection => connection.Query <T>(dbBuilder.GetCommand(DBAdapter)).ToList())); } dbBuilder.Compile(this.DBAdapter); var dbAnalyzer = DBAnalyzer.Init(dbBuilder.Sql, null, null, sortExpression); dbBuilder.Sql = dbAnalyzer.Select(); return(this.Do(dbBuilder, connection => connection.Query <T>(dbBuilder.GetCommand(DBAdapter)).ToList())); }
public void ToReader(DBBuilder dbBuilder, Action <IDataReader> action) { this.Do(dbBuilder, connection => { var reader = connection.ExecuteReader(dbBuilder.GetCommand(DBAdapter)); action(reader); return(reader); }); }
public DataTable ToDataTable(DBBuilder dbBuilder) { return(this.Do(dbBuilder, connection => { DataTable dt = new DataTable(); using (var reader = connection.ExecuteReader(dbBuilder.GetCommand(DBAdapter))) { dt.Load(reader); } return dt; })); }
public int Execute(DBBuilder dbBuilder) { return(this.Do(dbBuilder, connection => connection.Execute(dbBuilder.GetCommand(DBAdapter)))); }
public object ToScalar(DBBuilder dbBuilder) { return(this.Do(dbBuilder, connection => connection.ExecuteScalar(dbBuilder.GetCommand(DBAdapter)))); }