What would be a (write-only) counterpart to System.Data.IDataReader?

42 Views Asked by At

Background

I have a data processing app, where I have separated the "processing" modules from the "import" units. The "processing" modules get their data from arbitrary sources using the IDataReader interface provided by the importer modules which neatly provide field metadata and access to the field data, and allows unidirectional processing of the data. This meets my demands perfectly.

Now after my processing has completed (or potentially while it is still running), I would want to "export" the generated data in a similar fashion, and my mind expected there to be an write-only IDataWriter interface, which would allow for setting field values and adding new rows.

Unfortunately, the IDataWriter interface provided by MS is for a different use (stream writing)

My app is entirely written in C#, .Net8 and uses loose coupling (interfaces) and modular/plugins approach as much as possible.

I'm pretty sure I am no the first one encountering this, but nevertheless found an "aha obvious" counterpart to IDataReader ;)

(BTW - I am not native english speaking, so cut me some slack here)

The Question

What would be the "clean" way around this? Use the IDataTable interface? (I do not want the entire dataset to build up in RAM before it is closed/flushed, I'd rather write on-the-fly.

Or is there no such solution and should I define and implement an IDataWriter interface myself.

TIA

0

There are 0 best solutions below