How to handle a domain interacting with multiple infrastructure implementations #100
-
|
Hi! I’m a test development engineer and I’m very interested in your repo. I want to apply this layered architecture to a real scenario: I’m building an internal test case management platform. Test cases come from multiple sources/formats: Markdown / Excel files (file I/O) My confusion is about adapter selection. In your example, the application query service is bound to one concrete implementation during IoC registration. How should I handle multiple adapters? Options I’m considering: Define multiple gateways like TestCaseCsvGateway, TestCaseApiGateway, etc. Thanks for your time! |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
|
Hello, Tuner! I'd start with a separate interactor for each use case step expressible in code, defining ports it needs. Unifying is possible, but I wouldn't rush it until I'm sure contract overlap isn't coincidental and components won't evolve independently. If you need dynamic resolution, Dishka supports it via https://dishka.readthedocs.io/en/stable/advanced/when.html. Classic Strategy pattern is always an option too. |
Beta Was this translation helpful? Give feedback.
Hello, Tuner!
I'd start with a separate interactor for each use case step expressible in code, defining ports it needs. Unifying is possible, but I wouldn't rush it until I'm sure contract overlap isn't coincidental and components won't evolve independently.
If you need dynamic resolution, Dishka supports it via https://dishka.readthedocs.io/en/stable/advanced/when.html. Classic Strategy pattern is always an option too.