Example #1
0
 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[] { }));
     }
 }
Example #2
0
 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[] { }));
     }
 }