/// <summary> /// Copies the data for this field from one row of the input into the target object. /// </summary> /// <param name="target"></param> /// <param name="row"></param> /// <param name="rowNbr"></param> internal void Import(T target, ImportRecord row, int rowNbr) { if (TargetProperty == null) { return; } try { object val; if (ConvertFunc == null) { val = row.GetValue(FieldName, TargetProperty.PropertyType); } else { val = ConvertFunc(row.GetValue(FieldName)); val = ImportRecord.Convert(val, TargetProperty.PropertyType); } if (ImportTarget.ConvertFunc != null) { val = ImportTarget.ConvertFunc(val); } TargetProperty.SetValue(target, val); } catch (Exception ex) { throw new ImportException($"There was a problem importing the data for {FieldName} at row {rowNbr}", ex); } }