The examples in this section have demonstrated two of three common ways to inject dependencies:
- Constructor injection: When concrete implementations are used for proper functioning of the entire class, we can inject them as parameters to the constructor. This approach was not used in examples from this section, but I did implement a version of TDataProcessor that uses a constructor injection. You can explore the DataProcessing.ClassParams unit yourself to see how the constructor injection could be used in practice.
- Property injection: Sometimes, concrete implementations are used only under specific circumstances. In such cases, we can inject them as properties. Implementations in DataProcessing.InjectedProperties and DataProcessing.Factory ...