Using Dependency Injection to Fulfill Contracts
So we’ve defined plenty of interfaces in our Domain Services layer and implemented them with
concrete classes in our Persistence layer. We’ve discussed that nothing can directly depend on
this Persistence layer, so just how exactly do we use it in our application?
We previously discussed Dependency Injection as a means of preventing coupling, and that’s
just what we’d use here. Any time any class needs a concrete implementation of a repository,
it should declare a dependency to the interface, instead. For instance, when we discussed our
Factory that needed to find the next available account manager, remember, we only asked for an
interface:
Database Independence
92
Do'stlaringiz bilan baham: |