Ejemplo n.º 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);
        }
Ejemplo n.º 2
0
        public void Register <TTypeToResolve>(Func <IContainer, object> instanceExpression, Lifecycle lifecycle)
        {
            var registeredObject = new RegisteredObject(typeof(TTypeToResolve), instanceExpression, lifecycle);

            _registeredObjects.Add(registeredObject);
        }