private static string getoperation(OperaitonType o, string fieldname) { if (o == OperaitonType.addfield) { return("adding column " + fieldname + " in"); } else if (o == OperaitonType.addkey) { return("adding primary key " + fieldname + " in "); } else if (o == OperaitonType.alterfield) { return("altering column " + fieldname + " attributes in "); } else if (o == OperaitonType.dropfield) { return("droping column " + fieldname + " in "); } else if (o == OperaitonType.dropkey) { return("droping primary key in "); } else { return(" altering table in "); } }
public TableSchemaException(string tablename, string fieldname, OperaitonType operation, string message, System.Exception ex) : base(processMessage(tablename, fieldname, operation, message)) { }
public TableSchemaException(string tablename, string fieldname, OperaitonType operation, string message) : base(processMessage(tablename, fieldname, operation, null)) { TableName = tablename; Operation = operation; FieldName = fieldname; }
private static string processMessage(string tablename, string fieldname, OperaitonType operation, string message) { if (message == null) { return("Error while " + getoperation(operation, fieldname) + " " + tablename); } else { return("Error while " + getoperation(operation, fieldname) + " " + tablename + ":" + message); } }
public TableSchemaException() : base() { TableName = "Unknown table name"; Operation = OperaitonType.unknown; }