views:

35

answers:

1

From what I understand about Windsor Container and MVC applications, is that there should only be one instance of the container and it's usually registered in Global.asax for the running life of the application.

I've separated out my business layer in to a separate assembly from the web application and obviously I can't get to that instance unless I register the web application in the other assembly which would create a circular reference.

How do I use the container throughout my application? User a global static reference in my business layer assembly?

A: 

No - you don't. The documentation should give you an idea of how to use it.

Krzysztof Koźmic
I read the documentation and I now understand that the container resolves dependencies upon component creation, however, is there another way to inject dependencies without having public properties scattered everywhere?
Vince
Why would you need public properties?
Krzysztof Koźmic
ILogger as a property for example, this needs to be public in order for it to be resolved does it not?
Vince
you can also have it provided via .ctor dependency
Krzysztof Koźmic
But these are my only two options yes?
Vince
What else would you want? That's how you populate dependencies in any C# code, regardless of whether it uses a container or not
Krzysztof Koźmic