public bool FieldNamesFromTableType(Type table, out string[] fields)
 {
     /* translates the attributes of a table definition's field list into a list of field objects */
     table = PromoteListType2ElementType(table);
     FieldInfo[] fi = TableDef.GetNonConstantFieldInfos(table);
     if (fi.Length > 0)
     {
         List <string> f = new List <string>();
         for (int i = 0; i < fi.Length; i++)
         {
             if (fi[i].IsLiteral)
             {
                 /* this is to exclude the field name constants */
                 continue;
             }
             f.Add(fi[i].Name);
         }
         fields = f.ToArray();
     }
     else
     {
         fields = new string[] { };
     }
     return(true);
 }
 /// <summary>
 /// Used for bulk insert preparation.
 /// Returns the list of column names that will
 /// be part of the bulk insert, which can be
 /// used directly for the column mappings which
 /// is necessary on MSSQL because otherwise,
 /// the field mapping would be done by ordinal by default,
 /// which is not valid because in SHERM DAL, we do
 /// not rely on same column order inter logical and
 /// physical table definitions.
 /// </summary>
 public string[] Inject(Type ttype, Tcollection data)
 {
     _data      = data;
     rowcount   = data.Count;
     fi         = TableDef.GetNonConstantFieldInfos(ttype);
     col_lookup = new Dictionary <string, int>();
     for (int i = 0; i < fi.Length; ++i)
     {
         col_lookup.Add(fi[i].Name, i);
     }
     return(col_lookup.Keys.ToArray());
 }
        public bool FieldCollectionFromTableType(Type table, bool allow_recurse, out Fields fields)
        {
            /* translates the attributes of a table definition's field list into a list of field objects */
            table  = PromoteListType2ElementType(table);
            fields = new Fields();
            Field fldx;

            FieldInfo[] fi = TableDef.GetNonConstantFieldInfos(table);
            for (int i = 0; i < fi.Length; ++i)
            {
                /* the "IsLiteral" clause is to exclude the field name constants */
                if (FieldFromFieldType(fi[i], allow_recurse, out fldx))
                {
                    fields.Add(fldx);
                }
            }
            return(true);
        }