ioc-container

Who is using P&P Common Service Locator?

Who is using it? Is there any OS framework that relies on it? ...

Registering Types at Runtime

I'm trying to figure out how to register a type at run-time using unity. Any Suggestions? Basically I want to be able to do this: Container. RegisterType(Of IMyInterface)( Type.GetType("Fully Qualified Type Name")) ...

Inversion of control for your Inversion of control container?

I've recently had to update a relatively large control library that uses Ninject 1.0 to Ninject 2.0 to help resolve some issues I had with 1.0. The update has gone well and I think Ninject 2.0 is a lot quicker. However to try and avoid this problem in the future I have created my own interface for injecting fields and properties (which ...

What other IoC containers have an IInitializable like feature?

I've been using Castle Windsor in my previous project and I liked it a lot. For my current project I'm looking to use a different IoC container. Castle Windsor hasn't had any new releases since 2007 and is still not at version 1.0 so it is hard to justify using it in a commercial environment. One of the things I like about Castle Windso...

Castle Windsor passing constructor parameters

I have an IAddress class with a few properties. I then have a concrete type that implements this interface. This concrete type has a couple of different constructors I could use. How can I pass parameter values to one of these constructors at run-time? I cannot use the config file as I will be reusing this concrete type multiple time...

Is there a Dependency Injection Framework for Delphi or Free Pascal?

For some of my Delphi / Free Pascal projects I consider using Dependency Injection. Are there already implementations available (or in development) which provide some basic DI (IoC) functionality? Edit: I am not looking for a .NET based solution for Delphi.Net or Prism - in this case, the question would have been: which one should I pic...

Dependency Injection resolve and unit testing

Hi I'm trying to learn dependency injection and have come across a problem, when unit testing the application. I'm writing a console application and the container is created and initialized in Main(), it's available as a get-property in Program.Container, so anywhere in my application I can call Program.Container.Resolve<..>(). I have...

How do I manage dynamic dependencies with PicoContainer?

Say I have two classes A and B, with B depending on A. public class A {} public class B { public B(A a) {} } It's easy to resolve B in a single PicoContainer. final MutablePicoContainer root = new PicoBuilder().build(); root.addComponent(new A()); root.addComponent(B.class, B.class); System.out.println(root.getCo...

Contextual Binding with Castle Windsor

Hi all Is it possible to get Windsor to return different implementations of a service based on a seperate parameter? For example, if I have a User object which has a Role property, I would like to be able to hydrate this object differently according the the value of Role. I would like to use an IUserService to do this, but have the con...

How to register same type twice with different constructors in Unity?

I'm trying to register the same type but with two different constructors. When I trying to resolve, I get "Resolution of the dependency failed" on the second Resolve. var container = new UnityContainer(); container.RegisterType<IBar, Bar>() .RegisterInstance(new Bar()) .RegisterType<IBar, Bar>() .Regist...

Why do I need an IoC container as opposed to straightforward DI code?

I've been using Dependency Injection (DI) for a while, injecting either in a constructor, property, or method. I've never felt a need to use an Inversion of Control (IoC) container. However, the more I read, the more pressure I feel from the community to use an IoC container. I played with .NET containers like StructureMap, NInject, U...

What are the differences between Castle Windsor 1.0 RC3 and Castle Windsor 2.0?

I've been reading a bunch and playing around with Castle Windsor 1.0 RC3 lately and really like the functionality it provides. Recently 2.0 was released but for the time being I'm pretty much stuck with RC3 for the next little while. So with that in mind what are some of the glaring differences between the two versions and what are some ...

Is there TryResolve in Unity?

How can I make Unity not to throw ResolutionFailedException if Resolve fails? Is there something like TryResolve? var container = new UnityContainer(); var foo = container.TryResolve<IFoo>(); Assert.IsNull(foo); ...

Is it correct to have many Castle Windsor containers per application if those containers belong to different tiers?

I've been playing around with Castle Windsor lately and realized I could use it to back a container-like object I currently use already. So far I've only read information about an application having only one container instance per application. Is it correct to have many containers per application if those containers belong to different t...

Does spring.net recurse sub directories?

When the spring.net framework starts up for an asp.net application does the component that registers all objects in the IoC container recurse all sub-directories referenced in the web.config? eg. <spring> <context> <resource uri="~/bin/ClientService/ClientService.config"/> <resource uri="~/MCFModule.config"/> </context> </s...

What is Component-Driven Development?

Component-Driven Development term is starting to get used widely, esp. in connection with Inversion of Control. What is it? What problems does it solve? When is it appropriate and when not? ...

The hunt for the J2ME-friendly IoC container is on!

Hi all, I'm in the beginning phases of a Blackberry/J2ME project -- and along with other limitations that come with this wonderful platform, the lack of support for reflection and 1.3 language level mean that the vast majority of existing IoC containers are unusable. (Google has Guice for Android with no AOP, but even that requires sup...

How are you able to Unit Test your controllers without an IoC container?

I'm starting to get into Unit Testing, Dependancy Injection and all that jazz while constructing my latest ASP.NET MVC project. I'm to the point now where I would like to Unit Test my Controllers and I'm having difficulty figuring out how to appropriately do this without an IoC container. Take for example a simple controller: public c...

How to detect if a type is a Func<T> and get the type of the T

I am wondering whether I can upgrade a basic IoC container I am using to support lazy load. So if I have registered IFoo, I would like the IoC container to know how to fulfil both of the following dependencies (the first being the standard way IoC containers work, while the second returns a simple delegate that calls into the container f...

How to hide the real IoC container library?

Hi, I want to isolate all my code from the IoC container library that I have chosen (Unity). To do so, I created an IContainer interface that exposes Register() and Resolve(). I created a class called UnityContainerAdapter that implements IContainer and that wraps the real container. So only the assembly where UnityContainerAdapter is ...