private void Update(string key, Func <IocActivator, object> factory, LifeTime lifeTime) { Func <IocActivator, object> value; if (lifeTime.Equals(LifeTime.Singleton)) { var singleton = new Lazy <object>(() => factory(activator)); value = a => singleton.Value; } else { value = factory; } Update(key, value); }
private void Update(string key, Func<IocActivator, object> factory, LifeTime lifeTime) { Func<IocActivator, object> value; if (lifeTime.Equals(LifeTime.Singleton)) { var singleton = new Lazy<object>(() => factory(activator)); value = a => singleton.Value; } else { value = factory; } Update(key, value); }