Centralize configuration for mapping
Hi
I really like this tool however I was wondering if it was possible to centralize the mapping configuration in one location without the need to pass it around, as this can lead to polluting various projects. so every time I call the either it takes the default configuration set by me or allows me to override it.
Hope that make sense.
Regards
Ayaz
Does this scenario not work for you?
var csv = new CsvReader( someReader );
csv.Configuration.HasHeaderRecord = false;
No, say for example I have mappers, and I want the csv reader to use those mapping classes every time I use the parser, I would have to pass the config around which makes it more difficult. Ideally you would call config once during start up or something, set up the configuration then every time CsvReader is instantiated that configuration would be injected into it or something like that.
On Mon, Jul 24, 2017 at 8:06 PM, Josh Close [email protected] wrote:
Does this scenario not work for you?
var csv = new CsvReader( someReader );csv.Configuration.HasHeaderRecord = false;
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/JoshClose/CsvHelper/issues/717#issuecomment-317523621, or mute the thread https://github.com/notifications/unsubscribe-auth/AdAkAxSHF6fJ8m28SsZFLuPKUJDIpQGfks5sROtHgaJpZM4Ohm1J .
That sounds like what an IoC container is used for.
That's exactly what I do. IoC is the answer.
On Jul 24, 2017 3:41 PM, "Josh Close" [email protected] wrote:
That sounds like what an IoC container is used for.
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/JoshClose/CsvHelper/issues/717#issuecomment-317532443, or mute the thread https://github.com/notifications/unsubscribe-auth/AD_ohdQ6KXVChS7jRnK_y_nN5dGTdzXZks5sRPNtgaJpZM4Ohm1J .
Closing this as I don't think it's the responsibility of this library.