Well...
Basically it should not matter why and what...
My all project uses DI everywhere. Its abstracted well enough to use any framework.
So for you I guess what is needed to change is in DependencyInjectionInfoStorage class, method:
private static object GetInstanceForInjection(InjectionInfo info)
I am pretty sure it is possible to change Activator with some kind of interface and use static property to access it (and to have possibility to replace it on application startup).
for example (code is simplified, not tested, written here, so might be some mistakes, maybe that's not the only place)
(LLBLGenPro v4.2)
public interface IInstanceFactory
{
object Create(Type instanceType);
}
public class DefaultInstanceFactory : IInstanceFactory
{
public object Create(Type instanceType)
{
return Activator.CreateInstance(instanceType);
}
}
public static class DependencyInjectionInstances
{
private static IInstanceFactory _factory = new DefaultInstanceFactory();
public static IInstanceFactory Factory
{
get { return _factory ?? new DefaultInstanceFactory(); }
set { _factory = value; }
}
}
// lets change your class
internal class DependencyInjectionInfoStorage
{
// ...... other methods here
// lets modify this (see: now I can use any DI container here)
private static object GetInstanceForInjection(InjectionInfo info)
{
object instance;
if(info.ContextType == DependencyInjectionContextType.Singleton)
{
if(!_instanceCache.TryGetValue(info.InstanceType, out instance))
{
// not there
instance = DependencyInjectionInstances.Factory.Create(info.InstanceType);
_instanceCache.Add(info.InstanceType, instance);
}
}
else
{
instance = DependencyInjectionInstances.Factory.Create(info.InstanceType);
}
return instance;
}
}