Questions tagged [castle-windsor]

Castle Windsor is an Inversion of Control container for .NET. There is comprehensive documentation available which can answer most of your questions so it's always worthwhile to RTM first. Also check out its group on Google groups, which is where most of Castle experts hang out.

Castle Windsor is a best of breed, mature Inversion of Control container available for .NET.

There is comprehensive documentation available which can answer most of your questions so it's always worthwhile to RTM first.

Installation

Castle.Windsor can most easily be installed through its NuGet package.

Install-Package Castle.Windsor
2769 questions
198
votes
5 answers

What is Castle Windsor, and why should I care?

I'm a long-time Windows developer, having cut my teeth on win32 and early COM. I've been working with .NET since 2001, so I'm pretty fluent in C# and the CLR. I'd never heard of Castle Windsor until I started participating in Stack Overflow. I've…
David Hill
  • 4,102
  • 2
  • 23
  • 19
145
votes
4 answers

Ioc/DI - Why do I have to reference all layers/assemblies in application's entry point?

(Related to this question, EF4: Why does proxy creation have to be enabled when lazy loading is enabled?). I'm new to DI, so bear with me. I understand that the container is in charge of instantiating all of my registered types but in order to do so…
diegohb
  • 1,857
  • 2
  • 16
  • 34
86
votes
2 answers

Why not use an IoC container to resolve dependencies for entities/business objects?

I understand the concept behind DI, but I'm just learning what different IoC containers can do. It seems that most people advocate using IoC containers to wire up stateless services, but what about using them for stateful objects like…
70
votes
1 answer

How do I effectively design my application where most classes depend on ILogger?

I am injecting a Logger component into all my classes. Most of my classes have the Logger property defined, except where there is inheritance chain (in that case only the base class has this property, and all the deriving classes use that). When…
user1178376
  • 928
  • 2
  • 10
  • 24
52
votes
2 answers

Comparing Castle Windsor, Unity and StructureMap

In a follow up to Krzysztof’s statement that Windsor does a lot more than other IoC’s, I wanted to understand how these IoC’s stack up against each other and the benefits/additional facilities that castle Windsor provides. Are there any…
49
votes
2 answers

Design - Where should objects be registered when using Windsor

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…
Fredrik Jansson
  • 3,764
  • 3
  • 30
  • 33
42
votes
1 answer

Castle Windsor - IoC registration for open generic interfaces?

Does Castle Windsor permit registration of an open generic interface or do I need to register each possible typed instance separately? Example - the below with types T,Z fails upon compilation unless I separately specify T, Z with strong types. …
goldfinger
  • 1,105
  • 1
  • 20
  • 29
39
votes
9 answers

Which Dependency Injection Tool Should I Use?

I am thinking about using Microsoft Unity for my Dependency Injection tool in our User Interface. Our Middle Tier already uses Castle Windsor, but I am thinking I should stick with Microsoft. Does anyone have any thoughts about what the best…
37
votes
1 answer

Proper Hub dependency lifetime management for SignalR and Castle Windsor

I have some SignalR hubs which may need to access some transient and singleton dependencies. Hooking the creation of the Hub is easy and works just fine however SignalR does its own Dispose() call on the created Hub rather than notifying the…
Ian Yates
  • 1,324
  • 13
  • 24
35
votes
7 answers

Castle Windsor are there any downsides?

I have been looking into the Castle project and specifically Windsor. I have been so impressed with what is possible with this technology and the benefits of having a such a loosely coupled system are definitely apparent. The only thing I am unsure…
34
votes
3 answers

Castle Windsor Dependency Resolver for MVC 3

Since the IoC/DI implementation in MVC 3 is most likely in its final form in the RC, I'm looking for an updated implementation of the DependencyResolver, IControllerActivator and IViewPageActivator using Caste Windsor. Are there any examples out…
James H
  • 2,401
  • 3
  • 22
  • 20
33
votes
5 answers

How to use Castle Windsor with ASP.Net web forms?

I am trying to wire up dependency injection with Windsor to standard asp.net web forms. I think I have achieved this using a HttpModule and a CustomAttribute (code shown below), although the solution seems a little clunky and was wondering if there…
Xian
  • 76,121
  • 12
  • 43
  • 49
31
votes
2 answers

In Castle Windsor 3, override an existing component registration in a unit test

I am attempting to use Castle Windsor in my automated tests like so: On every test: The Setup() function creates a Windsor container, registering default implementations of each component The Test function access the components via the method…
Andrew Shepherd
  • 44,254
  • 30
  • 139
  • 205
31
votes
3 answers

Why does Castle Windsor hold onto transient objects?

Recently I noticed my application appears to be eating memory that never gets released. After profiling with CLRProfiler I've found that the Castle Windsor container I'm using is holding onto objects. These objects are declared with the…
Scott Langham
  • 58,735
  • 39
  • 131
  • 204
29
votes
2 answers

Castle Windsor register class with constructor parameters

I have the following class: public class DatabaseFactory : Disposable, IDatabaseFactory where C : DbContext, BaseContext, new() { private C dataContext; private string connectionString; public DatabaseFactory(string…
Ivan-Mark Debono
  • 15,500
  • 29
  • 132
  • 263
1
2 3
99 100