protected string GetProcName(SqlStatementType statementType) { switch (statementType) { case SqlStatementType.Select: return(string.Format(FetchCommandFormat, SourceTable.Name)); case SqlStatementType.SelectBy: if (ParentTable == null) { throw new InvalidOperationException("ParentTable must be specified for SelectBy procs."); } return(string.Format(FetchByCommandFormat, SourceTable.Name, ParentTable.Name)); case SqlStatementType.Insert: return(string.Format(InsertCommandFormat, SourceTable.Name)); case SqlStatementType.Update: return(string.Format(UpdateCommandFormat, SourceTable.Name)); case SqlStatementType.Delete: return(string.Format(DeleteCommandFormat, SourceTable.Name)); default: throw new ArgumentOutOfRangeException("statementType", statementType.ToString(), "No command format has been defined for this SqlStatementType"); } }
protected string GetSqlStatement(SqlStatementType statementType, int indentLevel) { switch (statementType) { case SqlStatementType.Select: return(this.GetSelectStatement(false, indentLevel)); case SqlStatementType.SelectBy: return(this.GetSelectStatement(true, indentLevel)); case SqlStatementType.Insert: return(GetInsertStatement(indentLevel)); case SqlStatementType.Update: return(GetUpdateStatement(indentLevel)); case SqlStatementType.Delete: return(GetDeleteStatement(indentLevel)); default: throw new ArgumentOutOfRangeException("statementType", statementType.ToString(), "No statement template has been defined for this SqlStatementType"); } }
protected string GetProcName(SqlStatementType statementType) { switch(statementType) { case SqlStatementType.Select: return string.Format(FetchCommandFormat, SourceTable.Name); case SqlStatementType.SelectBy: if(ParentTable == null) throw new InvalidOperationException("ParentTable must be specified for SelectBy procs."); return string.Format(FetchByCommandFormat, SourceTable.Name, ParentTable.Name); case SqlStatementType.Insert: return string.Format(InsertCommandFormat, SourceTable.Name); case SqlStatementType.Update: return string.Format(UpdateCommandFormat, SourceTable.Name); case SqlStatementType.Delete: return string.Format(DeleteCommandFormat, SourceTable.Name); default: throw new ArgumentOutOfRangeException("statementType", statementType.ToString(), "No command format has been defined for this SqlStatementType"); } }
protected string GetSqlStatement(SqlStatementType statementType, int indentLevel) { switch(statementType) { case SqlStatementType.Select: return this.GetSelectStatement(false, indentLevel); case SqlStatementType.SelectBy: return this.GetSelectStatement(true, indentLevel); case SqlStatementType.Insert: return GetInsertStatement(indentLevel); case SqlStatementType.Update: return GetUpdateStatement(indentLevel); case SqlStatementType.Delete: return GetDeleteStatement(indentLevel); default: throw new ArgumentOutOfRangeException("statementType", statementType.ToString(), "No statement template has been defined for this SqlStatementType"); } }