public static string GetProcedureName(this MethodInfo Obj) { string ProcedureName = null; var Attr = Obj.GetCustomAttributes(true); foreach (var item in Attr) { if (item.GetType() == typeof(SPName)) { SPName _SPNameAttr = item as SPName; ProcedureName = _SPNameAttr.Name; break; } } ProcedureName = ProcedureName ?? Obj.Name; return(ProcedureName); }
public virtual string printMe(bool includingTitle) { string spTitle = "\nfilename|spname|object type\n"; string tableTitle = "\nfilename|spname|object type|schema|table|table effect\n"; string columnTitle = "\nfilename|spname|object type|schema|table|column|location|coordinate|datatype\n"; string indexTitle = "\nfilename|spname|object type|schema|index|table|column|location|coordinate\n"; string schemaName = "N/A"; string tableName = "unknownTable"; string indexName = "unknownIndex"; StringBuilder sb = new StringBuilder(1024); switch (dbObjectType) { case EDbObjectType.procedure: if (includingTitle) { sb.Append(spTitle); } sb.Append(FileName + "|" + SPName.ToString() + "|" + dbObjectType); break; case EDbObjectType.table: if (includingTitle) { sb.Append(tableTitle); } tableName = getTableStr(Table); schemaName = Table.PrefixSchema; if (schemaName.Length == 0) { schemaName = "N/A"; } sb.Append(FileName + "|" + SPString + "|" + dbObjectType + "|" + schemaName + "|" + tableName + "|" + Table.EffectType); break; case EDbObjectType.column: if (includingTitle) { sb.Append(columnTitle); } if (Table != null) { //it's an orphan column tableName = getTableStr(Table); schemaName = Table.PrefixSchema; if (schemaName.Length == 0) { schemaName = "N/A"; } } else { tableName = "missed"; } sb.Append(FileName + "|" + SPString + "|" + dbObjectType + "|" + schemaName + "|" + tableName + "|" + Column.ToString() + "|" + Column.Location + "|(" + Column.coordinate() + ")"); break; case EDbObjectType.index: if (includingTitle) { sb.Append(indexTitle); } if (Table != null) { schemaName = Table.PrefixSchema; if (schemaName.Length == 0) { schemaName = "N/A"; } tableName = Table.TableName.ToString(); } if (Index != null) { indexName = Index.ToString(); } sb.Append(FileName + "|" + SPString + "|" + dbObjectType + "|" + schemaName + "|" + indexName + "|" + tableName + "|" + Column.ToString() + "|" + Column.Location + "|(" + Column.coordinate() + ")"); break; } return(sb.ToString()); }