Example #1
0
 public static string TemplateEntity(FieldInfo field)
 {
     StringBuilder codestring = new StringBuilder();
     codestring.Append("\r\npublic ")
         .Append(FriendlyName(field.DbType)).Append(" ")
         .Append(field.Name)
         .Append(" { get; set; } \r\n");
     return codestring.ToString();
 }
 TableInfo GetTableInfo(string ConnectionString, string TableName)
 {
     TableInfo table = new TableInfo();
     table.Name = TableName;
     string sql = "SELECT TOP 1 * FROM [" + TableName + "]";
     using (SqlDataReader rd = SqlHelper.ExecuteReader(ConnectionString, CommandType.Text, sql))
     {
         for (int i = 0; i < rd.FieldCount; i++)
         {
             FieldInfo field = new FieldInfo();
             field.Name = rd.GetName(i);
             field.DbType = rd.GetFieldType(i);
             table.Fields.Add(field);
         }
     }
     return table;
 }