IoC and managing interfaces

和自甴很熟 提交于 2019-12-06 08:33:29

I would define the interfaces within the business domain. Then the implementations of the interfaces would be in a library that references the business domain (and is referenced by whatever the application context is, or by an IoC library which is referenced by the application context).

Then swapping out one implementation with another is just a matter of creating another library and swapping the reference in the application context.

In a .NET project structure it would look something like this:

Domain Logic Project
    (references nothing)
    Domain Models
    Repository Interfaces
    IoC Service Locator Interface
Repository Project
    (References Domain Logic Project)
    Repository Implementations
IoC Project
    (References Domain Logic Project)
    (References Repository Project)
    IoC Service Locator Implementation
    IoC Bootstrapping
Application Project
    (References IoC Project)
    (References Domain Logic Project)
    (May need to reference Repository Project, not sure)
    Implements UI which interacts with Domain Models

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!