public string GetClassName() { return(DbTableInfo.GetSingularName(_Table_Name)); }
public string GetNetType() { if (this.IsForeignKey()) { return(DbTableInfo.GetSingularName(_DbForeignKeyInfo.PK_Table)); } string sqlType = Data_Type; // the suffix will add "?" at end if .net type is not a class and field is nullable string suf = (Is_Nullable) ? "?" : ""; if (sqlType.Equals("bigint")) { return("long" + suf); } if (sqlType.Equals("int")) { return("int" + suf); } if (sqlType.Equals("smallint")) { return("short" + suf); } if (sqlType.Equals("tinyint")) { return("byte" + suf); } if (sqlType.Equals("bit")) { return("bool" + suf); } if (sqlType.Equals("decimal")) { return("System.Decimal" + suf); } if (sqlType.Equals("numeric")) { return("System.Decimal" + suf); } if (sqlType.Equals("money")) { return("System.Decimal" + suf); } if (sqlType.Equals("smallmoney")) { return("System.Decimal" + suf); } if (sqlType.Equals("float")) { return("float" + suf); } if (sqlType.Equals("real")) { return("double" + suf); } if (sqlType.Equals("datetime")) { return("DateTime" + suf); } if (sqlType.Equals("smalldatetime")) { return("DateTime" + suf); } if (sqlType.Equals("char")) { return("string"); } if (sqlType.Equals("varchar")) { return("string"); } if (sqlType.Equals("text")) { return("string"); // might be HUGE! } if (sqlType.Equals("nchar")) { return("string"); } if (sqlType.Equals("nvarchar")) { return("string"); } if (sqlType.Equals("ntext")) { return("string"); } if (sqlType.Equals("binary")) { return("byte[]"); } if (sqlType.Equals("varbinary")) { return("byte[]"); } if (sqlType.Equals("image")) { return("byte[]"); } if (sqlType.Equals("uniqueidentifier")) { return("byte[]"); // this MAY be a byte[16] array } throw new Exception("Unexpected data type: " + Data_Type); }