コード例 #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);
        }
コード例 #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);
        }
コード例 #3
0
 public ScopedInstanceKey(ObjectDescription description, LifetimeScopeWithParent currentScope)
 {
     _description  = description;
     _currentScope = currentScope;
 }
コード例 #4
0
 protected LifetimeScopeWithParent(Kernel kernel, LifetimeScopeWithParent parentScope)
     : base(kernel)
 {
     _parentScope = parentScope;
 }