Design - Where should objects be registered when using Windsor
Posted
by Fredrik Jansson
on Stack Overflow
See other posts from Stack Overflow
or by Fredrik Jansson
Published on 2009-09-11T12:59:03Z
Indexed on
2010/05/19
9:20 UTC
Read the original article
Hit count: 354
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;
- Each layer can register its own objects. To test the BL, the test bench could register mock classes for the DAL.
- 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.
- The application (or test app) registers all objects of the dependencies.
Can someone help me with some ideas and pros/cons with the different paths? Links to example projects utilizing Castle Windsor in this way would be very helpful.
© Stack Overflow or respective owner