castle-windsor

Chaining containers with StructureMap

Is it possible to link containers together in StructureMap like it is in WindsorContainer.AddChildContainer()? I want to achieve having 3 container levels; - 1 page request level - 1 session level - 1 application level These would then be chained together so only one instance request would be made to the "base level" container. The le...

How can I improve this perWcfOperation Windsor lifestyle?

I have implemented a custom lifestyle for Windsor that will allow me to scope components to the current WCF operation. The biggest problem is that the call context initializer is executed after the service has been constructed which means that it cannot have dependencies on components with a perWcfLifestyle because the context for the pe...

ActiveRecord/NHibernate: handling Lazy collections in a persistence-unaware context

My web application (MonoRail, Windsor, ActiveRecord) has a Startable import service and one or more Startable import readers. When, for example, a file is dropped in a directory, a reader parses the file, passes the data to the service, which updates and/or creates objects through repositories. The problem I have is that these Startable ...

Castle Windsor: How do I wire up events in my configuration?

I have something like this: public interface IDeviceMonitor { int DeviceId { get; } event DeviceUpdatedHandler NewValueRecieved; void Start(); void Stop(); } public class DeviceInactivityDetector { ... public virtual void DeviceUpdated(IDeviceMonitor device, DeviceUpdatedArgs args) { .... } } curren...

Whats ResolveAll do

Hi guys Just a quick one. In IOC's what does ResolveAll do?? I know that the offical answer is "Resolve all valid components that match this type." but does that mean that it will return any class that implements a given interface? Cheers Anthony ...

Using Castle Windsor configuration files is it possible to delegate to another item declaration?

Using Castle-Windsor, is it possible to declare a type once and use this declaration for multiple Ids rather than writing it out in full each time. E.g. we have class Widget that implements IFoo and we want the keys "IFoo.A" and "IFoo.B" to get a Widget from Castle. I want to do something like <id="IFoo.Main" type="IFoo" service="W...

ASP.NET MVC Upgrade to Beta: IControllerFactory is defined in an assembly that is not referenced

Hi, I'm currently in the process of updating a site from preview 2 of ASP.NET MVC to the Beta release. I'm down to my last compile error with no solution in site after an exhaustive search. I have some code in Global.asax.cs which sets up IOC using the Windsor container: ControllerBuilder.Current.SetControllerFactory(typeof(WindsorContr...

Castle Windsor - Null constructor argument

How can I pass a null constuctor argument using Castle Windsor? I thought the following would work <parameters> <repository>null</repository> <message>null</message> </parameters> ...

Castle Windsor: How to break up my wire-up xml file into multiple files?

I remember seeing in a sample a while ago that it is possible to break up a windsor configuration file into multiple ones and reference them from the app.config in a way that they get parsed automatically. Of course I didn't bookmark it and now I can't find it and my Windsor.Config.xml file is creeping up on 600 lines. Can anyone tell ...

Usage of IoC Containers; specifically Windsor

I think the answer to this question is so obivous that noone has bothered writing about this, but its late and I really can't get my head around this. I've been reading into IoC containers (Windsor in this case) and I'm missing how you talk to the container from the various parts of your code. I get DI, I've been doing poor mans DI (em...

Castle Windsor: How to programatically pass a list parameter to the container?

Is it possible to pass a list constructor parameter when resolving a type? I want to use a programmatic configuration if possible. I've been playing around with the Parameters method as shown below, but I've not yet stumbled upon the answer. container.Register( Component .For<IDoSomething>() .ImplementedBy<DoSomething>() ...

What assemblies do I need to start using Castle Windsor in my application?

I've got a pretty basic question about how to start using Castle Windsor. I've read up on IOC/DI and would like to try Castle Windsor in an existing solution. I typically like to put any external assemblies in a Lib folder within the solution's folder tree so that the references are relative (I believe this is best practice). Which ...

Is there a PDF version of the Castle Windsor documentation?

The only documentation I've found for the components of the Castle project I've found here in the form of online HTML files. Does anyone know of anything that is more off-line friendly or printable (e.g. PDF). I've got quite the long train commute and I'd like to put something on my laptop. :-) ...

Castle Windsor with .net 3.5 framework

How can I use Windsor in my .net 3.5 solution? Can I use the binaries built for .net 2.0? Do I need to compile the Castle Windsor source myself, targeting 3.5? ...

Castle Windsor IOC and Order of Appearance in Config File

I'm new to Castle Windsor and am confused about the order in the config file. This is taken from the GettingStarted1 sample. The HttpServiceWatcher class takes an IFailureNotifier implementor in it's constructor. However, no matter how I order the two components that implement this interface -- AlarmFailureNotifier and EmailFailureNot...

Castle Windsor: How to specify a runtime value as a parameter (E.g. value returned from static function call)

I want to perform this CODE equivlant in the castle xml config file. // Foo(string name) IFoo f = new Foo(StaticBarClass.Name); XML Now for the XML, I know everything (e.g. the blah) except for the stuff inside the parameter part. What would the parameter part look like? <component id="blah" service="blah" t...

Castle windsor IoC and generics

Hey guys, I am having trouble with Castle windsors IoC container when trying to retrieve a generic type. I have added a component using generic notation without a type argumet i.e: <IoC> <components> <component id="NHibernateRepository" service="MobilePrototype.Domain.Interfaces.IRepository`1, MobilePrototype.Domain" type="M...

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 of is if using this method has any downsides, specifically in asp.net?? for example perfor...

Castle Windsor to Unity - can you auto-configure in Unity the same way you can in CW?

Hello, I don't know if this is too specific a question, if that is possible, but I'm having to port an app that uses Castle Windsor to Unity so that there isn't a reliance on non-microsoft approved libraries. I know I know but what are you going to do. Anyway I've managed it but I'm not happy with what I've got. In Windsor I had this: ...

Inject multiple service implementations with Castle Windsor

I would like to have Windsor inject multiple implementations of a service to a constructor. My scenario is that I have multiple search providers that implement a common interface. I would like to register each of these with windsor and then inject them into my search service so it can query each on in turn. Is such a thing possible wi...