using System; using System.Collections.Generic; using System.Text; namespace TestIOC { class SingletonContextLifecycle : ContextLifecycle { private Object _instance; /// /// resolve, if the instance is already created, not the need to create anymore. /// /// /// public override object Resolve(Castle.MicroKernel.CreationContext context) { if (_instance != null) return _instance; _instance = base.Resolve(context); return _instance; } } }