inversion-of-control

MEF = may experience frustration?

UPDATE As I've tried to get MEF working throughout my application, I'm coming across more an more places where I just don't get why it's not automatically creating my library when I expect it to. I think it all comes back to what Reed was saying about needing MEF to create everything. So right now, I have an XML reader class that need...

Autowiring collections with IoC

Hi, Anyone know if there exists any IoC container that can handle this: Given: ISomeInterfce<T> where T : Entity Impl1 : ISomeInterfce<Entity1> Impl2 : ISomeInterfce<Entity1> Impl3 : ISomeInterfce<Entity2> Impl4 : ISomeInterfce<Entity2> I want to be able to auto wire my system and be able to resolve like this IoC.ResolveAll(typ...

IoC container configuration

How should the configuration for an IoC container be organized? I know that registering by code should be placed at the highest level in an application, but what if an application had hundreds of dependencies that need to be registered? Same with XML configurations. I know that you can split up the XML configurations into multiple fil...

Having trouble getting MEF imports to be resolved

This is sort of a continuation of one of my earlier posts, which involves the resolving of modules in my WPF application. This question is specifically related to the effect of interdependencies of modules and the method of constructing those modules (i.e. via MEF or through new) on MEF's ability to resolve relationships. First of all,...

Is MEF an all-or-nothing affair?

I've had a few questions about MEF recently, but here's the big one -- is it really all-or-nothing, as it appears to be? My basic application structure is simply an app, several shared libraries that are intended to be singletons, and several different plugins (which may implement different interfaces). The app loads the plugins, and b...

Multiple exports with MEF does some really heinous stuff -- why, and why is it allowed?

I have an interesting situation where I need to do something like this: [Export[typeof(ICandy1)] [Export[typeof(ICandy2)] public class Candy : ICandy2 { ... } where public interface ICandy1 { ... } public interface ICandy2 : ICandy1 { ... } I couldn't find any posts anywhere regarding using multiple [Export] attributes, so I figur...

IoC problem with multi binding

I'm Java beginner and IoC as well. How to do stuff: public class Foo{ //private Bar bar; //Bar is an interface private int var; public Foo(){ } public void setVar(int var){ this.var = var;} public Bar getBar(){ if(var==1){ return new BarImpl1(); //an implemantation of Bar interface } else if(var==2){ return new BarImpl2(); //an imp...

How to achieve spring injection in oVal validation Framework?

This seems to be a big gap in it's spring integration. Has anybody done this or has successfully integrated Spring and Oval successfully? ...

How to inject dependencies in Collection form ??

How do I wire up dependencies where the dependency is in the form of a collection ?? For Example: public class Ninja { public List<IShuriken> Shurikens {get;set;} public IKatana Katana {get;set;} public void Attack() { // some code goes here to use weapons and kill people } } How do i use a container like Ninject in a case like t...

Combining MEF and IoC container

I primarily use NInject as my IoC container, and is very happy with it - don't want to change that. But some things I want to import using MEF. The thing is, I want the imports to created by the IoC container as the imports can have dependencies to things that I've registered in the NInject IoC. So, my question is: can I import the type...

Castle Windsor XML configuration for WCF proxy using WCF Integration Facility

Hi everybody! Currently, we use programming registration of WCF proxies in Windsor container using WCF Integration Facility. For example: container.Register( Component.For<CalculatorSoap>() .Named("calculatorSoap") .LifeStyle.Transient .ActAs(new DefaultClientModel { Endpoint = WcfEndpoint.FromConfig...

can I use the IOC when using a 3rd party library

Hi, Q1 If I have a reusable library that is available, that uses interfaces with classes that use the getInstance concept to create concrete classes for you to use, then in this case would that make sense on the client side to use the IOC container to create instances of these classes? Or is that really applying a double layer of abst...

Is is possible to programmatically change the resourceProviderFactoryType?

I have a custom implementation of IResourceProvider and ResourceProviderFactory. Now the default way of making sure ASP.NET uses these custom types is to use the web.config and specify the factory like so: <globalization resourceProviderFactoryType="Product.Globalization.TranslationResourceProviderFactory" /> This works perfectly, exc...

Unity Framework - passing integer's and strings into resolved objects

Hi, is there a way using the Unity framework to pass an integer as an argument into the constructor or a resolved object? Pseudo code.. IService svc = Container.Resolve<ConcreteService>() in this case Concrete service will be something like this... public class ConcreteService { public ConcreteService(int val) { } } Al...

Get instance of type inheriting from base class, implementing interface, using StructureMap

Continuing on my quest for a good plugin implementation I have been testing the StructureMap assembly scanning features. All plugins will inherit from abstract class PluginBase. This will provide access to common application services such as logging. Depending on it's function, each plugin may then implement additional interfaces, for e...

Asp.net Mvc: Ninject - IPrincipal

Hello, I was wondering how I could bind the IPrincipal to HttpContext.Current.User in Asp.net Mvc with Ninject. Friendly greetings, Pickels Edit: Not sure if it matters but I use my own CustomPrincipal class. ...

How can I validate the configuration of windsor castle

Hi, I want to assert that my registrations are valid, i.e no dependency is missing and there are no circular dependencies. I'd like to do that in my application (and not in a unit-test) so I'd be able to fail-fast if the configuration is invalid. I also want to accomplish that without resolving (and instantiating) all the components - on...

IoC in MVP Asp.NET

Hello, Guys. I'm developing a application using MVP and I have a question about How inject my dependencis in my presenters class. Because my presente receve too an instance of the my view. I thought of create a viewbase and inside it I create my dependencies instances and inject it in my presenter instance. Could also have a HttpModule ...

Registering Controllers using AutoFac in an ASP.NET MVC2 application with Areas

Hi, Has anyone been able to get AutofacControllerFactory working in applications where the controllers are split into Areas? Looks like it is not supported out of the box in the current version. Thanks ...

In Castle Windsor, can I register a Interface component and get a proxy of the implementation?

Lets consider some cases: _windsor.Register(Component.For<IProductServices>().ImplementedBy<ProductServices>().Interceptors(typeof(SomeInterceptorType)); In this case, when I ask for a IProductServices windsor will proxy the interface to intercept the interface method calls. If instead I do this : _windsor.Register(Component.For<Pr...