protected string[] reflectPKNames(Type dat) { List <string> pkList = new List <string>(); foreach (FieldInfo fi in dat.GetFields()) { if (fi.GetCustomAttributes(typeof(PrimaryKey), true).Length > 0) { object[] ca = fi.GetCustomAttributes(typeof(JoinKey), true); if (ca.Length > 0) { JoinKey jk = (JoinKey)ca[0]; pkList.Add(jk.tableA + "." + fi.Name); continue; } ca = fi.GetCustomAttributes(typeof(DBAlias), true); if (ca.Length > 0) { DBAlias a = (DBAlias)ca[0]; pkList.Add(a.alias); continue; } pkList.Add(fi.Name); } } return(pkList.ToArray()); }
protected virtual string reflectSelectFields(Type dat) { string values = ""; System.Reflection.FieldInfo[] fieldInfo = dat.GetFields(); foreach (System.Reflection.FieldInfo fi in fieldInfo) { object[] ca = fi.GetCustomAttributes(typeof(JoinKey), true); if (ca.Length > 0) { JoinKey jk = (JoinKey)ca[0]; values += jk.tableA + "."; } ca = fi.GetCustomAttributes(typeof(DBAlias), true); if (ca.Length > 0) { DBAlias a = (DBAlias)ca[0]; values += a.alias + ", "; } else { values += fi.Name + ", "; } } values = values.Substring(0, values.Length - 2); return(values); }
protected override string reflectSelectFields(Type dat) { string values = ""; System.Reflection.FieldInfo[] fieldInfo = dat.GetFields(); foreach (System.Reflection.FieldInfo fi in fieldInfo) { object[] ca = fi.GetCustomAttributes(typeof(JoinKey), true); if (ca.Length > 0) { JoinKey jk = (JoinKey)ca[0]; values += jk.tableA + "."; } ca = fi.GetCustomAttributes(typeof(DBAlias), true); if (ca.Length > 0) { DBAlias a = (DBAlias)ca[0]; values += a.alias + ", "; } else { #if USE_GMT_HACK if (fi.FieldType.ToString().Contains("System.DateTime")) { values += "date_gmt(" + fi.Name + ") as " + fi.Name + ", "; } else #endif { values += fi.Name + ", "; } } } values = values.Substring(0, values.Length - 2); return(values); }