public System.Data.IDbCommand SetupDbCommand(IStatementOrQuery statementOrQuery, IConnection connection) { if (statementOrQuery is Update) { return(this.SetupDbCommand(statementOrQuery as Update, connection)); } else if (statementOrQuery is Insert) { return(this.SetupDbCommand(statementOrQuery as Insert, connection)); } else if (statementOrQuery is Delete) { return(this.SetupDbCommand(statementOrQuery as Delete, connection)); } else if (statementOrQuery is BuilkInsert) { return(SetupDbCommand(statementOrQuery as BuilkInsert, connection)); } else { var DbCommand = connection.DbConnection.CreateCommand(); DbCommand.CommandText = this.SqlText(statementOrQuery); return(DbCommand); } }
public string SqlText(IStatementOrQuery command) { if (command is Select) { return(this.SqlText(command as Select)); } else if (command is Update) { return(this.SqlText(command as Update)); } else if (command is Insert) { return(this.SqlText(command as Insert)); } else if (command is Delete) { return(this.SqlText(command as Delete)); } else if (command is SetCommand) { return(this.SqlText(command as SetCommand)); } else if (command is BeginTransactionCommand) { return(this.SqlText(command as BeginTransactionCommand)); } else if (command is CommitCommand) { return(this.SqlText(command as CommitCommand)); } else if (command is RollBackCommand) { return(this.SqlText(command as RollBackCommand)); } else if (command is BuilkInsert) { return(this.SqlText(command as BuilkInsert)); } else { throw new NotImplementedException("Unrecognized ICommand command type " + command.GetType().ToString()); } }