Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 365709
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T13:33:47+00:00 2026-05-12T13:33:47+00:00

I will have the following components in my application DataAccess DataAccess.Test Business Business.Test Application

  • 0

I will have the following components in my application

  • DataAccess
  • DataAccess.Test
  • Business
  • Business.Test
  • Application

I was hoping to use Castle Windsor as IoC to glue the layers together but I am bit uncertain about the design of the gluing.

My question is who should be responsible for registering the objects into Windsor?
I have a couple of ideas;

  1. Each layer can register its own objects. To test the BL, the test bench could register mock classes for the DAL.
  2. Each layer can register the object of its dependencies, e.g. the business layer registers the components of the data access layer. To test the BL, the test bench would have to unload the “real” DAL object and register the mock objects.
  3. The application (or test app) registers all objects of the dependencies.

I am seeking some ideas and pros/cons with the different paths.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-12T13:33:48+00:00Added an answer on May 12, 2026 at 1:33 pm

    In general, all components in an application should be composed as late as possible, because that ensures maximum modularity, and that modules are as loosely coupled as possible.

    In practice, this means that you should configure the container at the root of your application.

    • In a desktop app, that would be in the Main method (or very close to it)
    • In an ASP.NET (including MVC) application, that would be in Global.asax
    • In WCF, that would be in a ServiceHostFactory
    • etc.

    The container is simply the engine that composes modules into a working application. In principle, you could write the code by hand (this is called Poor Man’s DI), but it is just so much easier to use a DI Container like Windsor.

    Such a Composition Root will ideally be the only piece of code in the application’s root, making the application a so-called Humble Executable (a term from the excellent xUnit Test Patterns) that doesn’t need unit testing in itself.

    Your tests should not need the container at all, as your objects and modules should be composable, and you can directly supply Test Doubles to them from the unit tests. It is best if you can design all of your modules to be container-agnostic.

    Also specifically in Windsor you should encapsulate your component registration logic within installers (types implementing IWindsorInstaller) See the documentation for more details

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

i have the following jquery code. basically i will have several overlapped divs and
I have the following situation: A user will define a certain filter on a
I have the following command which will loop over all the subdirectories in a
I have the following code, which will not work. The javascript gives no errors
The following query will display all Dewey Decimal numbers that have been duplicated in
A lot of the time I will have a Business object that has a
Most python frameworks will have a development webserver of some kind that will have
I'm building a class library that will have some public & private methods. I
I'm starting a Wordpress Blog that will have adult content on it, so I'll
In Visual Studio as most of you will have noticed that related file can

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.