0

I have a solution which is made up of several projects such as: DataLayer (Contains the EntityFramework), UnitTests, WebForms(Contains the MVP), CommonClasses (Contains common services classes).

Would you implement a single container for all of these projects, which is in a separate class-library application?

Or would you simply have a separate Windsor setup to handle dependencies within each one alone, but what if there is inner dependency between the individual projects.

Or is it a one for all Windsor Setup, which is inside the main project (The Startup project) to handle all dependencies?

Thanks.

Steven
  • 166,672
  • 24
  • 332
  • 435
t_plusplus
  • 4,079
  • 5
  • 45
  • 60

1 Answers1

2

Would you implement a single container for all of these projects

Since classes depend on classes from other assemblies (for instance your presenter would depend on a repository or a service from your business layer), your object graphs (a graph of objects that depend on each other) need to be built by one single container. So yes, you need one single container for all projects.

which is in a separate class-library application?

No. You should usually place this code in the startup path of your application, which -in your case- is the Web Forms project.

but what if there is inner dependency between the individual projects.

There will always be dependencies between your projects. Your web application wouldn't be very useful if it didn't call any business logic or didn't connect to the database.

Take a look at this Stackoverflow question (and answers) for more information about this subject. Here is an answer on the Simple Injector forum that talks about this as well. It's about Simple Injector and Onion architecture, but you'll find the answer informative and applicable to your situation.

Community
  • 1
  • 1
Steven
  • 166,672
  • 24
  • 332
  • 435