/// <summary> /// Generates the metadata head informations. /// </summary> /// <param name="table">The table.</param> /// <returns></returns> private static List <MetadataHeadInfo> GenerateMetadataHeadInfos(DataTable table) { DataColumnCollection columns = table.Columns; DataRowCollection rows = table.Rows; int columnCount = columns.Count; List <MetadataHeadInfo> headInfos = new List <MetadataHeadInfo>(); for (int i = 0; i < columnCount; i++) { string key = rows[keyRowIndex][i].ToString().Trim(); string typeString = rows[DefaultTypeRowIndex][i].ToString().Trim(); string comment = rows[DefaultCommentsRowIndex][i].ToString().Trim(); // Format key. if (metadataKeyFormatter != null) { key = metadataKeyFormatter(key); } // If key is not empty string, type is not empty string, and type is supported, then add item to list. if (!string.IsNullOrEmpty(key) && !string.IsNullOrEmpty(typeString) && IsSupportedDataType(typeString)) { ITypeParser typeParser = GetTypeParser(typeString); MetadataHeadInfo headInfo = new MetadataHeadInfo(); headInfo.key = key; headInfo.type = typeString; headInfo.parsedType = typeParser.ParseType(typeString); headInfo.comment = CommentFormatter(comment); headInfos.Add(headInfo); } } return(headInfos); }