-
Notifications
You must be signed in to change notification settings - Fork 127
Open
Description
Hello,
is it possible to map to objects containing nested objects when performing the mapping via column index?
public class EroeffnungbilanzWert
{
public string Kontonummer { get; set; }
public WertDaten Wertdaten { get; set; } = new();
}
public class WertDaten
{
public string Wert { get; set; }
public string Soll { get; set; }
public string Haben { get; set; }
}
By using this code the mapped values are not set to the nested object, but it runs without exception:
var excelMapper = new ExcelMapper(stream)
{
HeaderRow = true,
MinRowNumber = 2,
SkipBlankCells = false
};
excelMapper.AddMapping<EroeffnungbilanzWert>(5, s => s.Wertdaten.Soll);
This code results in an exception:
var excelMapper = new ExcelMapper(stream)
{
HeaderRow = false,
MinRowNumber = 2,
SkipBlankCells = false
};
excelMapper.AddMapping(4, s => s.Wertdaten.Soll);
But this code (not using nested object) works like expected:
var excelMapper = new ExcelMapper(stream)
{
HeaderRow = false,
MinRowNumber = 2,
SkipBlankCells = false
};
excelMapper.AddMapping(1, s => s.Kontonummer);
Metadata
Metadata
Assignees
Labels
No labels
