According to dependency inversion principle higher level module does not depend on lower level module rather they depend on abstraction. So it is a top down approach. I have a web project that has three tier. Tier 1 contain the view pages and controllers and viewmodels. Tier 2 is the Service layer and Tier 3 is repository. As the Web project is the most higher level module, it contains the interface that should be implemented by Service layer and Service layer contains the interface that should be implemented by repository. So Service layer has the reference of web project and repository has the reference of service layer. I am using autofac as IOC Container. As Service layer implement the interfaces of web project, I need to register interfaces to classes in Service layer in autofac module and also need to register the interfaces of service layer in repository layer in autofac module. As far as I know, I need to register the autofac module when the application starts. If I want to do so, I need to give the reference of service layer to web project and reference of repository layer to either in service layer or web project. But it will create circular build dependency if I want to follow the top down approach of DIP. My Question is How can I register the modules of autofac and maintain DIP?
Edit 1: Title of the question changes as I believe it would be a same approach for any DI Container