public void RegisterType <From, To>(bool singleton) where To : From { if (singleton) { creators[typeof(From)] = new SingletonCreator(typeof(To).GetConstructor(new Type[] { })); } else { creators[typeof(From)] = new NonSingletonCreator(typeof(To).GetConstructor(new Type[] { })); } }
public void RegisterType <T>(bool singleton) where T : class { if (singleton) { creators[typeof(T)] = new SingletonCreator(typeof(T).GetConstructor(new Type[] { })); } else { creators[typeof(T)] = new NonSingletonCreator(typeof(T).GetConstructor(new Type[] { })); } }