Cinchoo / ChoETL

ETL framework for .NET (Parser / Writer for CSV, Flat, Xml, JSON, Key-Value, Parquet, Yaml, Avro formatted files)
MIT License
801 stars 134 forks source link

BCP Incorrect condition? #318

Open adaml881 opened 6 months ago

adaml881 commented 6 months ago

This if-statement is incorrect and causing field mapping errors.

if (columnMappings == null || columnMappings.Count == 0)
{
    foreach (KeyValuePair<string, string> keyValuePair in columnMappings)
        bcp.ColumnMappings.Add(keyValuePair.Key, keyValuePair.Value);
}

I think it should be

if (bcp.ColumnMappings == null || bcp.ColumnMappings.Count == 0)
{
    foreach (KeyValuePair<string, string> keyValuePair in columnMappings)
        bcp.ColumnMappings.Add(keyValuePair.Key, keyValuePair.Value);
}

https://github.com/Cinchoo/ChoETL/blame/994986e883174324d0d1f6a9147e1174f85a7fa0/src/ChoETL/Common/ChoUtility.cs#L2254

Cinchoo commented 5 months ago

Yes, it is bug, will be appling fix.