private static void LifecycleIs(this ConfiguredInstance instance, Lifetime lifetime) { switch (lifetime) { case Lifetime.Singleton: instance.LifecycleIs <SingletonLifecycle>(); break; case Lifetime.PerRequest: instance.LifecycleIs <ContainerLifecycle>(); break; case Lifetime.Transient: instance.LifecycleIs <UniquePerRequestLifecycle>(); break; default: throw new ArgumentOutOfRangeException(nameof(lifetime), lifetime, "Invalid lifetime."); } }