Exemple #1
0
 public DbCommand BuildCommand(string connectionStringName)
 {
     var db = new DbCommon(connectionStringName);
     var cmd = db.CreateCommand(GetSql());
     foreach (var con in DbParams) {
         cmd.AddParameter(con.Name, con.Value, con.DbType);
     }
     return cmd;
 }
Exemple #2
0
 public SqlStatement(string connectionStringName)
 {
     db = new DbCommon(connectionStringName);
     sb = new StringBuilder();
     sbSets = new StringBuilder();
     sbConstraints = new StringBuilder();
     sbOrderBys = new StringBuilder();
     sbInserts = new StringBuilder();
     this.paramQueue = new Dictionary<string, object>();
     this.settingsQueue = new Dictionary<string, object>();
     this.insertValues = new Dictionary<string, object>();
     appendedStatements = new List<SqlStatement>();
     DbParams = new List<Parameter>();
 }
Exemple #3
0
 public static void Execute(this IEnumerable<DbCommand> commands, string connStringName)
 {
     var db=new DbCommon(connStringName);
     db.ExecuteTransaction(commands.ToArray());
 }
Exemple #4
0
 public static DbCommand ToCommand(this string sql, string connStringName)
 {
     var db=new DbCommon(connStringName);
     var cmd=db.CreateCommand(sql);
     return cmd;
 }
Exemple #5
0
 public static void Execute(this SortedList<int,DbCommand> commands, string connStringName)
 {
     //using a sorted list here to allow for sequential execution
     var db = new DbCommon(connStringName);
     db.ExecuteTransaction(commands);
 }