FileHelpers icon indicating copy to clipboard operation
FileHelpers copied to clipboard

Allow the creation of engine when the record type don't have a parameter less constructor

Open MarcosMeli opened this issue 10 years ago • 1 comments

Today we throw BadUsageException in the engine creation but maybe the user only want to write records, so there is no problem if there is no constructor.

Throw the BadUsageException only when trying to read objects

That will also speed up a bit the initial setup process because don't need to use reflection to take the constructor pointer on engine creation, that will be delayed to first read :)

MarcosMeli avatar Jun 29 '15 01:06 MarcosMeli

It would be even better if one could create the record in the engine.BeforeReadRecord Event. This way you get the freedom to use different factories for record creation without parameter less constructors and gain performance in the case of SkipThisRecord = true. Additionally you get the possibility to use different inherited types or classes implementing an interface. For backwards compatibility this behaviour is controlled with a boolean flag 'engine.DelayRecordCreation'.

Andreas2015 avatar Sep 07 '15 15:09 Andreas2015