-1

I have a ASP.NET MVC Web App with the following layers

UI Layer -> Service Layer -> Data Access Layer -> Database

Each layer is a separate project. Plus there is another project for each layer (apart from the UI Layer) which contains only the interfaces.

My question is, when building the Autofac container I specify the dependencies (Service Layer, Data Access Layer) along with the interfaces, in the OwinStartup Class. Is this the proper place to do this? If not how do I separate this.

user3547774
  • 1,621
  • 3
  • 20
  • 46
  • 1
    Related: https://stackoverflow.com/questions/9501604/ioc-di-why-do-i-have-to-reference-all-layers-assemblies-in-entry-application – Steven Jul 26 '14 at 11:31

1 Answers1

0

You will have to compose your container on the application level, e.g. using an OwinStartup class or similar. That said, I usually separate out the dependency setup for each assembly/project into their own Autofac module. This way, the assemblies become more self-contained. The application level setup also becomes much cleaner, its only responsibility is pulling in the various modules and building the container.

Peter Lillevold
  • 33,668
  • 7
  • 97
  • 131