Inverse mapping is incorrect
Steps to reproduce:
- Create a mapper using the .Index() extension, representing only a subset of the csv data (e.g. only map index 1, 3, 5)
- Write the record back to csv again
Expected result Will write back empty columns for non-represented fields such that index order is preserved
Actual result Writes back columns in order that they are mapped, without padding ignored columns
It just sorts by index and outputs in that order. I guess I always assumed that no index would be missing. I'll have to think if I want to allow this, or if I just consider it improperly mapped.
In 3.0 you can map without a property and set a constant to it for the blank rows you want.
Map( m => m.Id ).Index( 0 );
Map().Index( 1 ).Constant( null );
Map( m => m.Name ).Index( 2 );
Map().Index( 3 ).Constant( null );
Map( m => m.Date ).Index( 4 );
I think the example I gave is the expected way to do it. If you're writing, and have a custom mapping, you need to be explicit on your intentions. That was always the intended way. I'll make sure to put some documentation around this.