FlatFile icon indicating copy to clipboard operation
FlatFile copied to clipboard

Support customization of master-detail record handling

Open mthamil opened this issue 7 years ago • 0 comments

Using the fluent layout classes for record configuration, it is almost possible to completely decouple record models from the FlatFile library. The only exception is in the case of master/detail record relationships. This currently requires the use of the interfaces IMasterRecord and IDetailRecord.

In this pull request, I have factored out master-detail record handling into a pluggable mechanism. The stateful side of master-detail tracking can be replaced in its entirety using an implementation of the IMasterDetailTracker interface, or just the checking of whether records are a master or detail and what to do with them can be changed by providing a MasterDetailTrackerBase instance with different constructor parameters.

The changes should be backward compatible since the default implementation preserves the current behavior.

I have added tests using, somewhat ironically, an attribute-based implementation of master-detail records. It is really just based on the existing master-detail tests.

As a side note, I was not able to execute the tests in Visual Studio until I installed the xUnit Visual Studio runner package.

I welcome feedback and hope that this could be merged.

mthamil avatar Aug 05 '18 03:08 mthamil