public void Register <I, T>(string name, ObjectLifeSpans lifeSpan) where I : class where T : class, I { switch (lifeSpan) { case ObjectLifeSpans.Thread: container.Register <I, T>(name).AsThreadSingleton(); break; case ObjectLifeSpans.WebRequest: container.Register <I, T>(name).AsRequestSingleton(); break; case ObjectLifeSpans.Singleton: container.Register <I, T>(name).AsContainerSingleton(); break; case ObjectLifeSpans.Session: container.Register <I, T>(name).AsSessionSingleton(); break; case ObjectLifeSpans.Cached: container.Register <I, T>(name).AsCached(); break; default: container.Register <I, T>(name).AsAlwaysNew(); break; } }
//[DebuggerStepThrough] public static void Inject <T>(string name, T existing, ObjectLifeSpans lifeSpan) where T : class { Check.Argument.IsNotEmpty(name, "name"); Check.Argument.IsNotNull(existing, "existing"); resolver.Inject <T>(name, existing, lifeSpan); }
public void RegisterInstance <T>(string name, T instance, ObjectLifeSpans lifeSpan) where T : class { switch (lifeSpan) { case ObjectLifeSpans.Thread: container.RegisterInstance(name, typeof(T), instance).AsThreadSingleton(); break; case ObjectLifeSpans.WebRequest: container.RegisterInstance(name, typeof(T), instance).AsRequestSingleton(); break; case ObjectLifeSpans.Singleton: container.RegisterInstance(name, typeof(T), instance).AsContainerSingleton(); break; case ObjectLifeSpans.Session: container.RegisterInstance(name, typeof(T), instance).AsSessionSingleton(); break; case ObjectLifeSpans.Cached: container.RegisterInstance(name, typeof(T), instance).AsCached(); break; default: container.RegisterInstance(name, typeof(T), instance).AsAlwaysNew(); break; } }
public void Register <I, T>(ObjectLifeSpans lifeSpan) where I : class where T : class, I { switch (lifeSpan) { case ObjectLifeSpans.Singleton: container.Register <I, T>(new PerContainerLifetime()); break; case ObjectLifeSpans.WebRequest: container.Register <I, T>(new PerRequestLifeTime()); break; case ObjectLifeSpans.Thread: container.Register <I, T>(new PerThreadLifetime()); break; case ObjectLifeSpans.Session: container.Register <I, T>(new PerSessionLifetime()); break; case ObjectLifeSpans.Cached: container.Register <I, T>(new PerCachedLifetime()); break; case ObjectLifeSpans.Transient: default: container.Register <I, T>(); break; } }
public void RegisterInstance <T>(string name, T instance, ObjectLifeSpans lifeSpan) where T : class { switch (lifeSpan) { case ObjectLifeSpans.Singleton: case ObjectLifeSpans.Transient: case ObjectLifeSpans.WebRequest: case ObjectLifeSpans.Thread: case ObjectLifeSpans.Session: case ObjectLifeSpans.Cached: default: container.RegisterInstance(typeof(T), instance, name); break; } }
public static void RegisterInstance <I, T>(string name, T instance, ObjectLifeSpans lifeSpan) where I : class where T : class, I { resolver.RegisterInstance <I, T>(name, instance, lifeSpan); }
//[DebuggerStepThrough] public static void Register <I, T>(ObjectLifeSpans lifeSpan) where I : class where T : class, I { resolver.Register <I, T>(lifeSpan); }
public void Inject <T>(string name, T instance, ObjectLifeSpans lifeSpan) where T : class { RegisterInstance <T>(name, instance, lifeSpan); }