I am looking at moving from Ninject to a lighter weight (and faster) Ioc framework.
I picked up LightInject and am having a play, but can't find how to do the following:
From within a call to RegisterConstructorDependency I want to be able to determine the type of the object being resolved. The Param info gives me everything I need to know about the parameter location. But I cannot determine the target of the injection.
This is problematic when attempting to inject string values into constructors.
An example:
public interface IService { void Go(); }
public class Impl1 : IService {
public Impl1(string needsA){ }
public void Go(){ }
}
public class Impl2 : IService {
public Impl1(string needsA, string needsB){ }
public void Go(){ }
}
// Elsewhere
container.Register<IService, Impl1>();
container.Register<IService, Impl2>();
container.RegisterConstructorDependency<string>((factory, paramInfo) => ??? );
How in the registration of the constructor arg can I determine which implementation (Impl1 or Impl2) is being resolved. They may need different values to be passed to 'needsA'.
It may be that LightInject can't provide this information, and I need to expand my search.