Added IEntityFactory to abstract creation of entities during read.
Added IEntityFactory interface to abstract the process of creating new entity objects when reading a CSV stream.
This change allows the use of object-pooling semantics to reduce memory pressure when reading large CSV streams.
Thanks for your pull request.
Before I go ahead with this, could you please add a description of this interface to the article.htm file, plus why it's there and how to use it. That way, others can use your work.
Additionally, please add unit test(s) that ensure the code still works after your change.
Apologies!
In the end I ended up refactoring the CsvContext into CsvReadContext<T> and CsvWriteContext<T> which enabled me to use IEntityFactory<T> (instead of IEntityFactory) with the CsvReadContext<T> and thus made the implementation of IEntityFactory<T> much simpler. Obviously this is a breaking change compared to this pull request however if you are interested in seeing it (complete with unit tests and an example of it in use) then I'll generate a new pull request and back out of this one.