public MappingResponse Map(string filePath, char delimiter, NameValueCollection mappings) { using (var mapper = new CsvMapper <TranslationLabel>(filePath, delimiter)) { this.mappings = mappings; mapper.OnItemDataBound += CsvProcessor_OnItemDataBound; var translationLabels = mapper.MapToClass().Skip(1).ToList(); var response = new MappingResponse { Results = ReflectionUtility.GetDataTableByReflection <TranslationLabel>(translationLabels), Log = mapper.Log, SqlFilePath = this.CreateSql(translationLabels) }; return(response); } }
public virtual MappingResponse Map(List <string> filePaths, NameValueCollection mappings) { var rows = new List <T>(); var log = new List <LogEntry>(); foreach (var filePath in filePaths) { var mapper = new CsvMapper <T>(); rows.AddRange(mapper.Map(filePath, mappings).ToList()); log.AddRange(mapper.Log); } this.Rows = rows; var response = new MappingResponse { ResultsAsTable = ReflectionUtility.GetDataTableByReflection <T>(rows), Log = log }; return(response); }