Example #1
0
        private object GetInstance(RegisteredObject registeredObject)
        {
            var lifecycleCache = registeredObject.Lifecycle.Get().FindCache();
            var instance       = lifecycleCache.Get(registeredObject.InstanceKey);

            if (instance == null)
            {
                instance = registeredObject.CreateInstance(this);
                lifecycleCache.Set(registeredObject.InstanceKey, instance);
            }

            return(instance);
        }
Example #2
0
        public void Register <TTypeToResolve>(Func <IContainer, object> instanceExpression, LifeCycle lifeCycle)
        {
            var registeredObject = new RegisteredObject(typeof(TTypeToResolve), instanceExpression, lifeCycle);

            _registeredObjects.Add(registeredObject);
        }