I am working on a quick project to monitor / process data. In fact, these are just monitors, graphics, and processors. The monitor checks the data (ftp, local, imap, pop, etc.) using a schedule and sends new data to the processor. All of them have interfaces.
I am trying to find a reasonable way to use config to configure the graph / processor that each monitor uses. This is pretty easy:
<monitor type="any.class.implementing.monitor">
<schedule type="any.class.implementing.schedule">
...
</schedule>
<processor type="any.class.implementing.processor" />
</monitor>
What I'm struggling with is the best way to set up any old monitor / graph / processor thrown into a mix. On the one hand, it was possible to implement constructor parameters or properties (let's take any syntax):
<monitor type="any.class.implementing.monitor">
<args>
<arg value="..." />
</args>
<properties>
<property name="..." value=..." />
</properties>
<schedule type="any.class.implementing.schedule">
...
</schedule>
<processor type="any.class.implementing.processor" />
</monitor>
Another solution is the factory method in each interface, which takes the user configuration as a parameter:
public IMonitor Create(CustomConfigSection config);
, . ? ?
, DI . , , , , .