Ejemplo n.º 1
0
        internal void DoSetInstance(ObjectDescription description, LifetimeScopeWithParent currentScope, object instance)
        {
            if (_cachedInstances == null)
            {
                _cachedInstances = new Dictionary <ScopedInstanceKey, object>();
            }
            var key = new ScopedInstanceKey(description, currentScope);

            _cachedInstances.Add(key, instance);
        }
Ejemplo n.º 2
0
        internal object DoGetInstance(ObjectDescription description, LifetimeScopeWithParent currentScope)
        {
            if (_cachedInstances == null)
            {
                return(null);
            }
            var    key = new ScopedInstanceKey(description, currentScope);
            object instance;

            return(_cachedInstances.TryGetValue(key, out instance) ? instance : null);
        }