You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm adding to this so if others stumble upon this they know the actual property is: MakeOptional(). I found this to work to ignore a property that didn't exist in the file versus using the [ExcelIgnore] attribute on the property.
I find using MakeOptional is not ideal, because it will use custom mapping, and make ExcelColumnName attribute useless, please correct me if I'm wrong.
Ideally, we can still rely on ExcelColumnName as a default behavior, and use ExcelIgnore, so the column can read value if there is such column; and set to null if there is no such column (instead of throwing errors, because it could be legitimate not having a column sometimes).
Assuming two excel files, one with such column, and one without. And the code needs to work with both.
Map(bonus => bonus.PartnerFio) .WithColumnNameMatching(x => x == "partner_fio" || x == "fio" || x == "ФИО" || x == "ФИО Клиента") .WithEmptyFallback(null) .WithInvalidFallback(null);
How set default value, if field not mapped
The text was updated successfully, but these errors were encountered: